Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 431 → Rev 430

/trunk/projet_telechargement_dojo1.0.php
File deleted
/trunk/jrest/XML/Parser/Simple.php
File deleted
/trunk/jrest/XML/RSS.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Tree/Node.php
File deleted
/trunk/jrest/XML/Parser.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/Exception.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/Atom.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS09.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/Type.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS1Element.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS11Element.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS2Element.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS1.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS11.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS2.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/AtomElement.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Feed/Parser/RSS09Element.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Util.php
File deleted
\ No newline at end of file
/trunk/jrest/XML/Tree.php
File deleted
/trunk/jrest/lib/PEAR.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/helveticab.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/courier.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/timesi.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/timesbi.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/zapfdingbats.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/helveticai.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/helveticabi.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/times.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/timesb.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/helvetica.php
File deleted
/trunk/jrest/lib/File/PDF/fonts/symbol.php
File deleted
/trunk/jrest/lib/HTTP/Download.php
File deleted
/trunk/jrest/lib/HTTP/HTTP/Header.php
File deleted
/trunk/jrest/lib/JSON.php
File deleted
/trunk/jrest/lib/PDF.php
File deleted
/trunk/jrest/lib/SpreadsheetProductor.php
File deleted
/trunk/jrest/lib/PDFProductor.php
File deleted
/trunk/jrest/lib/WdHTMLParser.php
File deleted
\ No newline at end of file
/trunk/jrest/lib/Writer.php
File deleted
/trunk/jrest/lib/Log.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer/Format.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer/Worksheet.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer/OLEwriter.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer/Parser.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer/Workbook.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer/BIFFwriter.php
File deleted
/trunk/jrest/lib/Spreadsheet/Excel/Writer.php
File deleted
/trunk/jrest/lib/ezmlmAccessObject.class.php
File deleted
\ No newline at end of file
/trunk/jrest/lib/zip.php
File deleted
/trunk/jrest/cli.php
File deleted
\ No newline at end of file
/trunk/jrest/util/phpMyEdit.class.php
File deleted
/trunk/jrest/util/extensions/phpMyEdit-report.class.php
File deleted
/trunk/jrest/util/extensions/phpMyEdit-htmlarea.class.php
File deleted
/trunk/jrest/util/extensions/phpMyEdit-slide.class.php
File deleted
/trunk/jrest/util/extensions/phpMyEdit-mce-cal.class.php
File deleted
/trunk/jrest/util/extensions/phpMyEdit-calpopup.class.php
File deleted
/trunk/jrest/util/extensions/phpMyEdit-messages.class.php
File deleted
/trunk/jrest/util/lang/PME.lang.PL.inc
File deleted
/trunk/jrest/util/lang/PME.lang.IT.inc
File deleted
/trunk/jrest/util/lang/PME.lang.CZ.inc
File deleted
/trunk/jrest/util/lang/PME.lang.SK.inc
File deleted
/trunk/jrest/util/lang/PME.lang.RO.inc
File deleted
/trunk/jrest/util/lang/PME.lang.ZH.inc
File deleted
/trunk/jrest/util/lang/PME.lang.CA.inc
File deleted
/trunk/jrest/util/lang/PME.lang.PT.inc
File deleted
/trunk/jrest/util/lang/PME.lang.PT-BR.inc
File deleted
/trunk/jrest/util/lang/PME.lang.TR.inc
File deleted
/trunk/jrest/util/lang/PME.lang.RU.inc
File deleted
/trunk/jrest/util/lang/PME.lang.EN-US.inc
File deleted
/trunk/jrest/util/lang/PME.lang.DE.inc
File deleted
/trunk/jrest/util/lang/PME.lang.ZH-SG.inc
File deleted
/trunk/jrest/util/lang/PME.lang.ES-MX.inc
File deleted
/trunk/jrest/util/lang/PME.lang.DK.inc
File deleted
/trunk/jrest/util/lang/PME.lang.EL.inc
File deleted
/trunk/jrest/util/lang/PME.lang.EN.inc
File deleted
/trunk/jrest/util/lang/PME.lang.FR.inc
File deleted
/trunk/jrest/util/lang/PME.lang.ES.inc
File deleted
/trunk/jrest/util/lang/PME.lang.ES-AR.inc
File deleted
/trunk/jrest/util/lang/PME.lang.SE.inc
File deleted
/trunk/jrest/util/lang/PME.lang.ET.inc
File deleted
/trunk/jrest/util/lang/PME.lang.NL.inc
File deleted
/trunk/jrest/util/lang/PME.lang.EU.inc
File deleted
/trunk/jrest/util/images/alt/pme-delete.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-change.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-copy.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-view.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-delete.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-change.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-copy.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-view.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/cel_inventory.php
File deleted
/trunk/jrest/util/phpMyEditSetup.php
File deleted
/trunk/jrest/jrest.ini.php
1,45 → 1,39
;<?/*
[settings]
baseURL = "/client/projet/jrest/"
 
; Default
[appli]
phptype = mysql
username = telabotap
password = "shah=Ph3"
hostspec = localhost
database = tela_prod_v4
url_service_liste = vpopmail.tela-botanica.org/
domaine_service_liste = tela-botanica.org
url_base_projet = http://www.tela-botanica.org/page:liste_projets
guid = urn:lsid:tela-botanica.org:%s:%s
 
chemin_wikis_integres = /home/telabotap/www/wikini/
chemin_wiki_defaut = /home/telabotap/www/client/integrateur_wikini/bibliotheque/wikini_0_5/
nom_admin_wiki = WikiAdmin
adresse_admin_wiki = accueil@tela-botanica.org
pass_admin_wiki = "wqa&WQA1"
 
; Identification
[database_ident]
phptype = mysql
username = telabotap
password = "shah=Ph3"
hostspec = localhost
database = tela_prod
annuaire = annuaire_tela
ann_id = U_MAIL
ann_pwd = U_PASSWD
pass_crypt_funct = md5
 
 
; LOGS
[log]
cheminlog = "/client/projet/jrest/logs/"
timezone = "Europe/Paris"
taillemax = 100000
 
; ADMIN
[jrest_admin]
admin = aurelien@tela-botanica.org,david.delon@clapas.net,jpm@tela-botanica.org,marie@tela-botanica.org
;*/?>
;<?/*
[settings]
baseURL = "/projet_bp/jrest/"
 
; Default
[appli]
phptype = mysql
username = aurelien
password = Canard
hostspec = localhost
database = papyrus_bp
url_service_liste = vpopmail.tela-botanica.org/
domaine_service_liste = tela-botanica.org
adresse_appli_projet = http://www.tela-botanica.org/page:liste_projets
addresse_telechargement_docs = http://www.tela-botanica.org/projets/%s/telechargement/%s
 
; Identification
[database_ident]
phptype = mysql
username = aurelien
password = Canard
hostspec = localhost
database = tela_prod
annuaire = annuaire_tela
ann_id = U_MAIL
ann_pwd = U_PASSWD
pass_crypt_funct = md5
 
 
; LOGS
[log]
cheminlog = "/home/aurelien/Logs/"
timezone = "Europe/Paris"
taillemax = 100000
 
; ADMIN
[jrest_admin]
admin = aurelien@tela-botanica.org,david.delon@clapas.net,jpm@tela-botanica.org,marie@tela-botanica.org
;*/?>
/trunk/jrest/JRest.php
1,304 → 1,304
<?php
// In : utf8 url_encoded (get et post)
// Out : utf8
 
// TODO : gerer les retours : dans ce controleur : code retour et envoi ...
class JRest {
 
/** Parsed configuration file */
private $config;
 
/** The HTTP request method used. */
private $method = 'GET';
 
/** The HTTP request data sent (if any). */
private $requestData = NULL;
 
/** Array of strings to convert into the HTTP response. */
private $output = array();
 
/** Nom resource. */
private $resource = NULL;
 
/** Identifiant unique resource. */
private $uid = NULL;
 
/**
* Constructor. Parses the configuration file "JRest.ini", grabs any request data sent, records the HTTP
* request method used and parses the request URL to find out the requested resource
* @param str iniFile Configuration file to use
*/
public function JRest($iniFile = 'jrest.ini.php') {
 
$this->config = parse_ini_file($iniFile, TRUE);
if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && isset($_SERVER['QUERY_STRING'])) {
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 0) {
$this->requestData = '';
$httpContent = fopen('php://input', 'r');
while ($data = fread($httpContent, 1024)) {
$this->requestData .= $data;
}
fclose($httpContent);
}
if (strlen($_SERVER['QUERY_STRING']) == 0) {
$len = strlen($_SERVER['REQUEST_URI']);
} else {
$len = -(strlen($_SERVER['QUERY_STRING']) + 1);
}
$urlString = substr($_SERVER['REQUEST_URI'], strlen($this->config['settings']['baseURL']), $len);
 
$urlParts = explode('/', $urlString);
 
if (isset($urlParts[0])) $this->resource = $urlParts[0];
if (count($urlParts) > 1 && $urlParts[1] != '') {
array_shift($urlParts);
foreach ($urlParts as $uid) {
if ($uid != '') {
$this->uid[] = urldecode($uid);
}
}
}
 
$this->method = $_SERVER['REQUEST_METHOD'];
} else {
trigger_error('I require the server variables REQUEST_URI, REQUEST_METHOD and QUERY_STRING to work.', E_USER_ERROR);
}
}
 
/**
* Execute the request.
*/
function exec() {
 
switch ($this->method) {
case 'GET':
$this->get();
break;
case 'POST':
$this->post();
break;
case 'DELETE':
$this->delete();
break;
case 'PUT':
$this->add();
break;
}
}
 
/**
* Execute a GET request. A GET request fetches a list of resource when no resource name is given, a list of element
* when a resource name is given, or a resource element when a resource and resource unique identifier are given. It does not change the
* database contents.
*/
private function get() {
if ($this->resource) {
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if ($this->uid) { // get a resource element
if (method_exists($service, 'getElement')) {
$service->getElement($this->uid);
}
} elseif (method_exists($service, 'getRessource')) { // get all elements of a ressource
$service->getRessource();
}
}
}
} else { // get resources
// include set.jrest.php, instanticiation et appel
}
}
 
private function post() {
$pairs = array();
// Récupération des paramètres passés dans le contenu de la requête HTTP (= POST)
if ($this->requestData) {
$pairs = $this->parseRequestData();
}
 
// Ajout des informations concernant l'upload de fichier passées dans la variable $_FILE
if(isset($_FILES)) {
foreach ($_FILES as $v) {
$pairs[$v['name']] = $v;
}
 
// Ne pas effacer cette ligne ! Elle est indispensable pour les services du Carnet en ligne
// qui n'utilisent que le tableau pairs dans les posts
$pairs = array_merge($pairs, $_POST);
}
 
// gestion du contenu du post
if(isset($_POST))
{
// Safari ne sait pas envoyer des DELETE avec gwt...
// Nous utilisons le parametre "action" passé dans le POST qui doit contenir DELETE pour lancer la supression
if ($pairs['action'] == 'DELETE') {
$this->delete();
return;
}
 
if (count($pairs) != 0) {
if ($this->uid) { // get a resource element
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if (method_exists($service,'updateElement')) { // Update element
// TODO : a voir le retour ...
if ($service->updateElement($this->uid, $pairs)) {
$this->created();
}
}
}
}
} else { // get all elements of a ressource
$this->add($pairs);
}
} else {
$this->lengthRequired();
}
}
}
 
private function delete() {
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if ($this->uid) { // get a resource element
if (method_exists($service, 'deleteElement')) { // Delete element
if ($service->deleteElement($this->uid)) {
$this->noContent();
}
}
}
}
}
}
 
private function add($pairs = null) {
if (is_null($pairs)) {
$pairs = array();
// Récupération des paramètres passés dans le contenu de la requête HTTP (= POST)
// FIXME : vérifier que l'on récupère bien les données passées par PUT
if ($this->requestData) {
$pairs = $this->parseRequestData();
}
}
 
if (count($pairs) != 0) {
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if (method_exists($service,'createElement')) { // Create a new element
if ($service->createElement($pairs)) {
$this->created();
}
}
}
}
} else {
$this->lengthRequired();
}
}
 
/**
* Parse the HTTP request data.
* @return str[] Array of name value pairs
*/
private function parseRequestData() {
$values = array();
$pairs = explode('&', $this->requestData);
foreach ($pairs as $pair) {
$parts = explode('=', $pair);
if (isset($parts[0]) && isset($parts[1])) {
$parts[1] = rtrim(urldecode($parts[1]));
$values[$parts[0]] = $parts[1];
}
}
return $values;
}
 
/**
* Send a HTTP 201 response header.
*/
private function created($url = FALSE) {
header('HTTP/1.0 201 Created');
if ($url) {
header('Location: '.$url);
}
}
 
/**
* Send a HTTP 204 response header.
*/
private function noContent() {
header('HTTP/1.0 204 No Content');
}
 
/**
* Send a HTTP 400 response header.
*/
private function badRequest() {
header('HTTP/1.0 400 Bad Request');
}
 
/**
* Send a HTTP 401 response header.
*/
private function unauthorized($realm = 'JRest') {
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
header('WWW-Authenticate: Basic realm="'.$realm.'"');
}
header('HTTP/1.0 401 Unauthorized');
}
 
/**
* Send a HTTP 404 response header.
*/
private function notFound() {
header('HTTP/1.0 404 Not Found');
}
 
/**
* Send a HTTP 405 response header.
*/
private function methodNotAllowed($allowed = 'GET, HEAD') {
header('HTTP/1.0 405 Method Not Allowed');
header('Allow: '.$allowed);
}
 
/**
* Send a HTTP 406 response header.
*/
private function notAcceptable() {
header('HTTP/1.0 406 Not Acceptable');
echo join(', ', array_keys($this->config['renderers']));
}
 
/**
* Send a HTTP 411 response header.
*/
private function lengthRequired() {
header('HTTP/1.0 411 Length Required');
}
 
/**
* Send a HTTP 500 response header.
*/
private function internalServerError() {
header('HTTP/1.0 500 Internal Server Error');
}
}
<?php
// In : utf8 url_encoded (get et post)
// Out : utf8
 
// TODO : gerer les retours : dans ce controleur : code retour et envoi ...
class JRest {
 
/** Parsed configuration file */
private $config;
 
/** The HTTP request method used. */
private $method = 'GET';
 
/** The HTTP request data sent (if any). */
private $requestData = NULL;
 
/** Array of strings to convert into the HTTP response. */
private $output = array();
 
/** Nom resource. */
private $resource = NULL;
 
/** Identifiant unique resource. */
private $uid = NULL;
 
/**
* Constructor. Parses the configuration file "JRest.ini", grabs any request data sent, records the HTTP
* request method used and parses the request URL to find out the requested resource
* @param str iniFile Configuration file to use
*/
public function JRest($iniFile = 'jrest.ini.php') {
 
$this->config = parse_ini_file($iniFile, TRUE);
if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && isset($_SERVER['QUERY_STRING'])) {
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 0) {
$this->requestData = '';
$httpContent = fopen('php://input', 'r');
while ($data = fread($httpContent, 1024)) {
$this->requestData .= $data;
}
fclose($httpContent);
}
if (strlen($_SERVER['QUERY_STRING']) == 0) {
$len = strlen($_SERVER['REQUEST_URI']);
} else {
$len = -(strlen($_SERVER['QUERY_STRING']) + 1);
}
$urlString = substr($_SERVER['REQUEST_URI'], strlen($this->config['settings']['baseURL']), $len);
 
$urlParts = explode('/', $urlString);
 
if (isset($urlParts[0])) $this->resource = $urlParts[0];
if (count($urlParts) > 1 && $urlParts[1] != '') {
array_shift($urlParts);
foreach ($urlParts as $uid) {
if ($uid != '') {
$this->uid[] = urldecode($uid);
}
}
}
 
$this->method = $_SERVER['REQUEST_METHOD'];
} else {
trigger_error('I require the server variables REQUEST_URI, REQUEST_METHOD and QUERY_STRING to work.', E_USER_ERROR);
}
}
 
/**
* Execute the request.
*/
function exec() {
 
switch ($this->method) {
case 'GET':
$this->get();
break;
case 'POST':
$this->post();
break;
case 'DELETE':
$this->delete();
break;
case 'PUT':
$this->add();
break;
}
}
 
/**
* Execute a GET request. A GET request fetches a list of resource when no resource name is given, a list of element
* when a resource name is given, or a resource element when a resource and resource unique identifier are given. It does not change the
* database contents.
*/
private function get() {
if ($this->resource) {
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if ($this->uid) { // get a resource element
if (method_exists($service, 'getElement')) {
$service->getElement($this->uid);
}
} elseif (method_exists($service, 'getRessource')) { // get all elements of a ressource
$service->getRessource();
}
}
}
} else { // get resources
// include set.jrest.php, instanticiation et appel
}
}
 
private function post() {
$pairs = array();
// Récupération des paramètres passés dans le contenu de la requête HTTP (= POST)
if ($this->requestData) {
$pairs = $this->parseRequestData();
}
 
// Ajout des informations concernant l'upload de fichier passées dans la variable $_FILE
if(isset($_FILES)) {
foreach ($_FILES as $v) {
$pairs[$v['name']] = $v;
}
 
// Ne pas effacer cette ligne ! Elle est indispensable pour les services du Carnet en ligne
// qui n'utilisent que le tableau pairs dans les posts
$pairs = array_merge($pairs, $_POST);
}
 
// gestion du contenu du post
if(isset($_POST))
{
// Safari ne sait pas envoyer des DELETE avec gwt...
// Nous utilisons le parametre "action" passé dans le POST qui doit contenir DELETE pour lancer la supression
if ($pairs['action'] == 'DELETE') {
$this->delete();
return;
}
 
if (count($pairs) != 0) {
if ($this->uid) { // get a resource element
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if (method_exists($service,'updateElement')) { // Update element
// TODO : a voir le retour ...
if ($service->updateElement($this->uid, $pairs)) {
$this->created();
}
}
}
}
} else { // get all elements of a ressource
$this->add($pairs);
}
} else {
$this->lengthRequired();
}
}
}
 
private function delete() {
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if ($this->uid) { // get a resource element
if (method_exists($service, 'deleteElement')) { // Delete element
if ($service->deleteElement($this->uid)) {
$this->noContent();
}
}
}
}
}
}
 
private function add($pairs = null) {
if (is_null($pairs)) {
$pairs = array();
// Récupération des paramètres passés dans le contenu de la requête HTTP (= POST)
// FIXME : vérifier que l'on récupère bien les données passées par PUT
if ($this->requestData) {
$pairs = $this->parseRequestData();
}
}
 
if (count($pairs) != 0) {
$resource_file = 'services/'.ucfirst($this->resource).'.php';
$resource_class = ucfirst($this->resource);
if (file_exists($resource_file)) {
include_once $resource_file;
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if (method_exists($service,'createElement')) { // Create a new element
if ($service->createElement($pairs)) {
$this->created();
}
}
}
}
} else {
$this->lengthRequired();
}
}
 
/**
* Parse the HTTP request data.
* @return str[] Array of name value pairs
*/
private function parseRequestData() {
$values = array();
$pairs = explode('&', $this->requestData);
foreach ($pairs as $pair) {
$parts = explode('=', $pair);
if (isset($parts[0]) && isset($parts[1])) {
$parts[1] = rtrim(urldecode($parts[1]));
$values[$parts[0]] = $parts[1];
}
}
return $values;
}
 
/**
* Send a HTTP 201 response header.
*/
private function created($url = FALSE) {
header('HTTP/1.0 201 Created');
if ($url) {
header('Location: '.$url);
}
}
 
/**
* Send a HTTP 204 response header.
*/
private function noContent() {
header('HTTP/1.0 204 No Content');
}
 
/**
* Send a HTTP 400 response header.
*/
private function badRequest() {
header('HTTP/1.0 400 Bad Request');
}
 
/**
* Send a HTTP 401 response header.
*/
private function unauthorized($realm = 'JRest') {
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
header('WWW-Authenticate: Basic realm="'.$realm.'"');
}
header('HTTP/1.0 401 Unauthorized');
}
 
/**
* Send a HTTP 404 response header.
*/
private function notFound() {
header('HTTP/1.0 404 Not Found');
}
 
/**
* Send a HTTP 405 response header.
*/
private function methodNotAllowed($allowed = 'GET, HEAD') {
header('HTTP/1.0 405 Method Not Allowed');
header('Allow: '.$allowed);
}
 
/**
* Send a HTTP 406 response header.
*/
private function notAcceptable() {
header('HTTP/1.0 406 Not Acceptable');
echo join(', ', array_keys($this->config['renderers']));
}
 
/**
* Send a HTTP 411 response header.
*/
private function lengthRequired() {
header('HTTP/1.0 411 Length Required');
}
 
/**
* Send a HTTP 500 response header.
*/
private function internalServerError() {
header('HTTP/1.0 500 Internal Server Error');
}
}
?>
/trunk/jrest/index.php
1,38 → 1,38
<?php
 
// Decommenter ces lignes si version de php < 5
//require_once 'lib/JSON.php';
 
// Lazy require
// TODO : voir si on ne peut pas dépacer ces inclusions directement dans les services.
//require_once 'lib/DBAccessor.php';
//require_once 'lib/SpreadsheetProductor.php';
//require_once 'lib/PDFProductor.php';
//require 'JRest.php';
 
/**
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
*
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
*
*@param string le nom de la classe appelée.
*@return void le fichier contenant la classe doit être inclu par la fonction.
*/
function __autoload($classe)
{
if (class_exists($classe)) {
return null;
}
 
$chemins = array('', 'services/', 'services/include/', 'lib/');
foreach ($chemins as $chemin) {
$chemin = $chemin.$classe.'.php';
if (file_exists($chemin)) {
require_once $chemin;
}
}
}
 
$jRest =& new JRest();
$jRest->exec();
<?php
 
// Decommenter ces lignes si version de php < 5
//require_once 'lib/JSON.php';
 
// Lazy require
// TODO : voir si on ne peut pas dépacer ces inclusions directement dans les services.
//require_once 'lib/DBAccessor.php';
//require_once 'lib/SpreadsheetProductor.php';
//require_once 'lib/PDFProductor.php';
//require 'JRest.php';
 
/**
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
*
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
*
*@param string le nom de la classe appelée.
*@return void le fichier contenant la classe doit être inclu par la fonction.
*/
function __autoload($classe)
{
if (class_exists($classe)) {
return null;
}
 
$chemins = array('', 'services/', 'services/include/', 'lib/');
foreach ($chemins as $chemin) {
$chemin = $chemin.$classe.'.php';
if (file_exists($chemin)) {
require_once $chemin;
}
}
}
 
$jRest =& new JRest();
$jRest->exec();
?>
/trunk/jrest/services/ProjetSyndication.php
File deleted
/trunk/jrest/services/squelettes/atom.tpl.xml
File deleted
\ No newline at end of file
/trunk/jrest/services/squelettes/rss1.tpl.xml
File deleted
\ No newline at end of file
/trunk/jrest/services/squelettes/rss2.tpl.xml
File deleted
/trunk/jrest/services/squelettes/diff.tpl.html
File deleted
\ No newline at end of file
/trunk/jrest/services/Suppression.php
1,69 → 1,69
<?php
/**
* PHP Version 5
*
* @category PHP
* @package projet_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/projet_bp/
*/
 
class Suppression extends ProjetService {
 
public function getElement($uid) {
 
$id_utilisateur = (isset($_GET['id_utilisateur'])) ? $_GET['id_utilisateur'] : false;
$mail = (isset($_GET['mail'])) ? $_GET['mail'] : false;
 
if(!$id_utilisateur) {
return false;
}
 
// on selectionne la liste des projets auxquel on est inscrit
$projets = $this->obtenirProjetsPourParticipant($id_utilisateur);
// si pas de projets, rien à faire
if(count($projets) <= 0) {
$this->envoyer("OK");
return;
}
 
// sinon on itère sur chaque projet
foreach($projets as $projet) {
 
$id_projet = $projet['p_id'];
// et on le supprime du projet
$suppression_participant = $this->supprimerParticipantAProjet($id_utilisateur, $id_projet);
 
// ainsi que des listes associées
if($mail) {
$id_projet = $projet['p_id'];
$listes = $this->obtenirListesAssocieesAuProjet($id_projet);
// si pas de liste, rien à faire
if(count($listes) <= 0) {
continue;
}
 
$nom_liste = $listes[0]['pl_nom_liste'];
$id_liste = $listes[0]['pl_id_liste'];
$suppression_liste = $this->supprimerInscriptionAListeProjet($id_utilisateur, $id_liste);
 
// on supprime l'abonnement
if($this->estAbonneAListe($nom_liste, $mail)) {
if(!$this->desinscriptionListe($nom_liste, $mail)) {
$this->envoyer("false");
}
}
}
}
 
$this->envoyer("OK");
return;
}
}
?>
<?php
/**
* PHP Version 5
*
* @category PHP
* @package projet_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/projet_bp/
*/
 
class Suppression extends ProjetService {
 
public function getElement($uid) {
 
$id_utilisateur = (isset($_GET['id_utilisateur'])) ? $_GET['id_utilisateur'] : false;
$mail = (isset($_GET['mail'])) ? $_GET['mail'] : false;
 
if(!$id_utilisateur) {
return false;
}
 
// on selectionne la liste des projets auxquel on est inscrit
$projets = $this->obtenirProjetsPourParticipant($id_utilisateur);
// si pas de projets, rien à faire
if(count($projets) <= 0) {
$this->envoyer("OK");
return;
}
 
// sinon on itère sur chaque projet
foreach($projets as $projet) {
 
$id_projet = $projet['p_id'];
// et on le supprime du projet
$suppression_participant = $this->supprimerParticipantAProjet($id_utilisateur, $id_projet);
 
// ainsi que des listes associées
if($mail) {
$id_projet = $projet['p_id'];
$listes = $this->obtenirListesAssocieesAuProjet($id_projet);
// si pas de liste, rien à faire
if(count($listes) <= 0) {
continue;
}
 
$nom_liste = $listes[0]['pl_nom_liste'];
$id_liste = $listes[0]['pl_id_liste'];
$suppression_liste = $this->supprimerInscriptionAListeProjet($id_utilisateur, $id_liste);
 
// on supprime l'abonnement
if($this->estAbonneAListe($nom_liste, $mail)) {
if(!$this->desinscriptionListe($nom_liste, $mail)) {
$this->envoyer("false");
}
}
}
}
 
$this->envoyer("OK");
return;
}
}
?>
/trunk/jrest/services/MigrationWiki.php
1,195 → 1,273
<?php
 
class MigrationWiki extends ProjetService {
const dry_run = false;
private function executerRequeteManip($requete, $mode_fetch = false) {
// Fonction de commodité pour afficher les requetes au lieu de les executer
if (self::dry_run) {
echo str_replace('),','),'.NL, $requete);
return true;
} else {
if($mode_fetch) {
return $this->bdd->query($requete)->fetchAll($mode_fetch);
} else {
return $this->bdd->query($requete);
}
}
}
private function executerRequete($requete, $mode_fetch = false) {
if (self::dry_run) {
echo '<pre>'.str_replace('),','),'.NL, $requete).'</pre>';
}
 
$retour = $this->bdd->query($requete)->fetchAll($mode_fetch);
return $retour;
}
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
define('NL',"\n");
}
 
public function getElement($uid){
exit;
$requete_projets_wikinis = 'SELECT * FROM gen_wikini';
$wikinis_projets = $this->executerRequete($requete_projets_wikinis, PDO::FETCH_ASSOC);
foreach($wikinis_projets as $wikini) {
 
// test sur un wiki
if($wikini['gewi_code_alpha_wikini'] != 'relais') {
continue;
}
 
$base = $wikini['gewi_bdd_nom'];
$prefixe = $wikini['gewi_table_prefix'];
$chemin_wiki_sur_site = $this->config['appli']['chemin_wikis_integres'];
$chemin_wiki = $wikini['gewi_chemin'];
echo NL.'Traitement du wiki '.$chemin_wiki.NL;
echo NL.$chemin_wiki.NL;
if(!file_exists($chemin_wiki)) {
echo 'Impossible de migrer le wikini '.$wikini['gewi_code_alpha_wikini'].' : le dossier n\'existe pas'.NL.NL.NL.NL;
continue;
}
$chemin_base_wiki_defaut = $this->config['appli']['chemin_wiki_defaut'];
$nom_admin = $this->config['appli']['nom_admin_wiki'];
$mail_admin = $this->config['appli']['adresse_admin_wiki'];
$pass_admin = $this->config['appli']['pass_admin_wiki'];
$infos_admin = array('name' =>$nom_admin, 'email' => $mail_admin, 'password' => $pass_admin);
//if(!$this->verifierPresenceTableTriple($base, $prefixe)) {
echo 'migration du wiki '.$wikini['gewi_code_alpha_wikini'].NL;
// $this->creerTableTriple($base, $prefixe);
// $this->ajouterUtilisateurAdmin($base,$prefixe, $infos_admin);
$this->copierFichiersWikini($chemin_base_wiki_defaut, $chemin_wiki);
$this->changerVersionWakkaConfig($chemin_wiki);
echo 'migration du wiki '.$wikini['gewi_code_alpha_wikini'].' effectuée '.NL.NL.NL.NL;
//} else {
// echo 'wiki dejà à jour '.$wikini['gewi_code_alpha_wikini'].NL.NL.NL.NL;
//}
}
}
 
private function verifierPresenceTableTriple($base, $prefixe) {
$requete_presence_table = 'SELECT COUNT(*) as table_existe FROM information_schema.tables
WHERE TABLE_SCHEMA = "'.$base.'" AND TABLE_NAME = "'.$prefixe.'triples"';
$resultat_presence_table = $this->executerRequete($requete_presence_table);
$presence_table = false;
foreach($resultat_presence_table as $table_est_presente) {
if($table_est_presente['table_existe'] >= 1) {
$presence_table = true;
break;
}
}
return $presence_table;
}
 
private function creerTableTriple($base, $prefixe) {
echo 'Création de la table triple '.NL;
$requete_creation_table = 'CREATE TABLE '.$base.'.'.$prefixe.'triples (' .
' id int(10) unsigned NOT NULL auto_increment,' .
' resource varchar(255) NOT NULL default \'\',' .
' property varchar(255) NOT NULL default \'\',' .
' value text NOT NULL default \'\',' .
' PRIMARY KEY (id),' .
' KEY resource (resource),' .
' KEY property (property)' .
') TYPE=MyISAM';
 
return $this->executerRequeteManip($requete_creation_table);
}
private function verifierPresenceTableUsers($base, $prefixe) {
$requete_presence_table = 'SELECT COUNT(*) as table_existe FROM information_schema.tables
WHERE TABLE_SCHEMA = "'.$base.'" AND TABLE_NAME = "'.$prefixe.'users"';
$resultat_presence_table = $this->executerRequete($requete_presence_table);
$presence_table = false;
foreach($resultat_presence_table as $table_est_presente) {
if($table_est_presente['table_existe'] >= 1) {
$presence_table = true;
break;
}
}
return $presence_table;
}
private function ajouterUtilisateurAdmin($base, $prefixe, $infos_admin) {
if(!$this->verifierPresenceTableUsers($base, $prefixe)) {
echo 'Impossible d\'ajouter l\'adminwiki : '.$prefixe.'_users n\'existe_pas'.NL;
return;
}
echo 'Ajout de l\'utilisateur wikiAdmin '.NL;
$requete_suppression_si_admin_present = 'DELETE FROM '.$base.'.'.$prefixe.'users '.
'WHERE name ="'.$infos_admin['name'].'"';
$this->executerRequeteManip($requete_suppression_si_admin_present);
$requete_creation_admin = "INSERT INTO ".$base.'.'.$prefixe."users SET ".
"signuptime = now(), ".
"name = '".$infos_admin['name']."', ".
"email = '".$infos_admin['email']."', ".
"password = md5('".$infos_admin['password']."')";
return $this->executerRequeteManip($requete_creation_admin);
}
private function changerVersionWakkaConfig($chemin_wikini) {
 
if(file_exists($chemin_wikini.'/wakka.config.php')) {
$contenu_wakka_config = file_get_contents($chemin_wikini.'/wakka.config.php');
$contenu_wakka_config_maj = str_replace('"wikini_version" => "0.4.3"','"wikini_version" => "0.5.0"',$contenu_wakka_config);
$contenu_wakka_config_maj = str_replace("'wikini_version' => '0.4.3'","'wikini_version' => '0.5.0'",$contenu_wakka_config_maj);
if(self::dry_run) {
echo 'Wakka Config mis à jour '.$contenu_wakka_config_maj.NL;
} else {
file_put_contents($chemin_wikini.'/wakka.config.php', $contenu_wakka_config_maj);
}
echo 'Changement de la version de wikini '.NL;
} else {
echo 'Attention ! le fichier '.$chemin_wikini.'/wakka.config.php n\'existe pas '.NL;
}
}
private function copierFichiersWikini($chemin_base_wiki_defaut, $chemin_wiki_dest) {
echo 'copie de '.$chemin_base_wiki_defaut.' vers '.$chemin_wiki_dest.NL;
if(self::dry_run) {
$copie_recursive = true;
} else {
if(trim($chemin_base_wiki_defaut) != '/' && trim($chemin_wiki_dest) != '/') {
echo " cp -Rf -a ".$chemin_base_wiki_defaut."* ".$chemin_wiki_dest."/ 2>&1 ";
$copie_recursive = shell_exec( " cp -Rf -a ".$chemin_base_wiki_defaut."* ".$chemin_wiki_dest."/ 2>&1 " );
}
}
return $copie_recursive;
}
}
?>
<?php
 
class MigrationWiki extends ProjetService {
const dry_run = false;
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
define('NL',"\n");
}
private function executerRequeteManip($requete, $mode_fetch = false) {
// Fonction de commodité pour afficher les requetes au lieu de les executer
if (self::dry_run) {
echo '<pre>'.str_replace('),','),'.NL, $requete).'</pre>';
return true;
} else {
if($mode_fetch) {
return $this->bdd->query($requete)->fetchAll($mode_fetch);
} else {
return $this->bdd->query($requete);
}
}
}
private function executerRequete($requete, $mode_fetch = false) {
if (self::dry_run) {
echo '<pre>'.str_replace('),','),'.NL, $requete).'</pre>'.NL.NL;
}
return $this->bdd->query($requete)->fetchAll($mode_fetch);
}
public function getElement($uid){
$nom_admin = $this->config['appli']['nom_admin_wiki'];
$mail_admin = $this->config['appli']['adresse_admin_wiki'];
$pass_admin = $this->config['appli']['pass_admin_wiki'];
 
$requete_projets_wikinis = 'SELECT * FROM gen_wikini';
$wikinis_projets = $this->executerRequete($requete_projets_wikinis, PDO::FETCH_ASSOC);
foreach($wikinis_projets as $wikini) {
 
// test sur un wiki
/*if($wikini['gewi_code_alpha_wikini'] != 'bibliobota') {
continue;
}*/
 
$base = $wikini['gewi_bdd_nom'];
$prefixe = $wikini['gewi_table_prefix'];
$chemin_wiki_sur_site = $this->config['appli']['chemin_wikis_integres'];
//$chemin_wiki = $wikini['gewi_chemin'];
$chemin_wiki = '/home/aurelien/web/wikini/'.$wikini['gewi_code_alpha_wikini'];
echo NL.'Traitement du wiki '.$chemin_wiki.NL;
echo NL.$chemin_wiki.NL;
if(!file_exists($chemin_wiki)) {
echo 'Impossible de migrer le wikini '.$wikini['gewi_code_alpha_wikini'].' : le dossier n\'existe pas'.NL.NL.NL.NL;
continue;
}
$chemin_base_wiki_defaut = $this->config['appli']['chemin_wiki_defaut'];
$infos_admin = array('name' =>$nom_admin, 'email' => $mail_admin, 'password' => $pass_admin);
if(!$this->verifierPresenceTableTriple($base, $prefixe)) {
echo 'migration du wiki '.$wikini['gewi_code_alpha_wikini'].NL;
$this->creerTableTriple($base, $prefixe);
$this->ajouterUtilisateurAdmin($base,$prefixe, $infos_admin);
$this->copierFichiersWikini($chemin_base_wiki_defaut, $chemin_wiki);
$this->changerVersionWakkaConfig($chemin_wiki);
echo 'migration du wiki '.$wikini['gewi_code_alpha_wikini'].' effectuée '.NL.NL.NL.NL;
} else {
echo 'wiki dejà à jour '.$wikini['gewi_code_alpha_wikini'].NL.NL.NL.NL;
}
$this->ajoutPageFormatees($chemin_wiki, $infos_admin);
}
}
 
private function verifierPresenceTableTriple($base, $prefixe) {
$requete_presence_table = 'SELECT COUNT(*) as table_existe FROM information_schema.tables
WHERE TABLE_SCHEMA = "'.$base.'" AND TABLE_NAME = "'.$prefixe.'triples"';
$resultat_presence_table = $this->executerRequete($requete_presence_table);
$presence_table = false;
foreach($resultat_presence_table as $table_est_presente) {
if($table_est_presente['table_existe'] >= 1) {
$presence_table = true;
break;
}
}
return $presence_table;
}
 
private function creerTableTriple($base, $prefixe) {
echo 'Création de la table triple '.NL;
$requete_creation_table = 'CREATE TABLE '.$base.'.'.$prefixe.'triples (' .
' id int(10) unsigned NOT NULL auto_increment,' .
' resource varchar(255) NOT NULL default \'\',' .
' property varchar(255) NOT NULL default \'\',' .
' value text NOT NULL default \'\',' .
' PRIMARY KEY (id),' .
' KEY resource (resource),' .
' KEY property (property)' .
') TYPE=MyISAM';
 
return $this->executerRequeteManip($requete_creation_table);
}
private function verifierPresenceTableUsers($base, $prefixe) {
$requete_presence_table = 'SELECT COUNT(*) as table_existe FROM information_schema.tables
WHERE TABLE_SCHEMA = "'.$base.'" AND TABLE_NAME = "'.$prefixe.'users"';
$resultat_presence_table = $this->executerRequete($requete_presence_table);
$presence_table = false;
foreach($resultat_presence_table as $table_est_presente) {
if($table_est_presente['table_existe'] >= 1) {
$presence_table = true;
break;
}
}
return $presence_table;
}
private function ajouterUtilisateurAdmin($base, $prefixe, $infos_admin) {
if(!$this->verifierPresenceTableUsers($base, $prefixe)) {
echo 'Impossible d\'ajouter l\'adminwiki : '.$prefixe.'_users n\'existe_pas'.NL;
return;
}
echo 'Ajout de l\'utilisateur wikiAdmin '.NL;
$requete_suppression_si_admin_present = 'DELETE FROM '.$base.'.'.$prefixe.'users '.
'WHERE name ="'.$infos_admin['name'].'"';
$this->executerRequeteManip($requete_suppression_si_admin_present);
$requete_creation_admin = "insert into ".$base.'.'.$prefixe."users set ".
"signuptime = now(), ".
"name = '".$infos_admin['name']."', ".
"email = '".$infos_admin['email']."', ".
"password = md5('".$infos_admin['password']."')";
return $this->executerRequeteManip($requete_creation_admin);
}
private function changerVersionWakkaConfig($chemin_wikini) {
 
if(file_exists($chemin_wikini.'wakka.config.php')) {
$contenu_wakka_config = file_get_contents($chemin_wikini.'wakka.config.php');
$contenu_wakka_config_maj = str_replace('"wikini_version" => "0.4.3"','"wikini_version" => "0.5.0"',$contenu_wakka_config);
$contenu_wakka_config_maj = str_replace("'wikini_version' => '0.4.3'","'wikini_version' => '0.5.0'",$contenu_wakka_config_maj);
if(self::dry_run) {
echo 'Wakka Config mis à jour '.$contenu_wakka_config_maj.NL;
} else {
//file_put_contents($chemin_wikini.'wakka.config.php', $contenu_wakka_config_maj);
}
echo 'Changement de la version de wikini '.NL;
} else {
echo 'Attention ! le fichier '.$chemin_wikini.'wakka.config.php n\'existe pas '.NL;
}
}
private function copierFichiersWikini($chemin_base_wiki_defaut, $chemin_wiki_dest) {
if(self::dry_run) {
echo 'copie de '.$chemin_base_wiki_defaut.' vers '.$chemin_wiki_dest.NL;
$copie_recursive = true;
} else {
if(trim($chemin_base_wiki_defaut) != '/' && trim($chemin_wiki_dest) != '/') {
$copie_recursive = shell_exec( " cp -Rf -a ".$chemin_base_wiki_defaut."* ".$chemin_wiki_dest." 2>&1 " );
}
}
return $copie_recursive;
}
private function ajoutPageFormatees($chemin_wikini, $utilisateur) {
$chemin_base_wiki_defaut = $this->config['appli']['chemin_wiki_defaut'];
require_once($chemin_base_wiki_defaut.'wakka_class.php');
$nom_admin = $this->config['appli']['nom_admin_wiki'];
$chemin_wikini = rtrim($chemin_wikini,'/');
require_once($chemin_wikini.'/wakka.config.php');
// la variable $wakkaConfig est contenu dans le fichier wakka.config.php
$config = $wakkaConfig;
$wiki = new Wiki($config);
$wiki->SetGroupACL("admins", $nom_admin);
$wiki->setUser($utilisateur);
//insertion des pages de documentation et des pages standards
$d = dir($chemin_base_wiki_defaut.'/setup/doc/');
while ($doc = $d->read()){
if (is_dir($doc) || substr($doc, -4) != '.txt') {continue;}
$pagecontent = implode ('', file($chemin_base_wiki_defaut.'/setup/doc/'.$doc));
$pagecontent = mb_convert_encoding($pagecontent,'UTF-8','ISO-8859-15');
if ($doc=='_root_page.txt'){
$pagename = $config["root_page"];
}else{
$pagename = substr($doc,0,strpos($doc,'.txt'));
}
$base = $config['mysql_database'];
$requete_existence_page = "Select tag from ".$base.".".$config['table_prefix']."pages where tag='$pagename'";
$existence_page = $this->executerRequete($requete_existence_page);
if (is_array($existence_page) && count($existence_page) > 0) {
echo 'la page '.$pagename.' existe déjà '.NL;
} else {
echo 'Ajout de la page '.$pagename.NL;
$requete_maj_pages_anciennes = "UPDATE ".$base.".".$config['table_prefix']."pages ".
"SET ".
"latest = 'N'".
"WHERE tag = '$pagename'";
$reussite = $this->executerRequeteManip($requete_maj_pages_anciennes);
$requete_insertion_page = "INSERT INTO ".$base.".".$config['table_prefix']."pages ".
"SET tag = '$pagename', ".
"body = ".$this->bdd->quote($pagecontent).", ".
"user = '".$nom_admin."', ".
"owner = '".$nom_admin."', " .
"time = now(), ".
"latest = 'Y'";
$reussite = $this->executerRequeteManip($requete_insertion_page);
if(!$reussite) {
echo 'echec de l\'ajout de la page '.$pagename.NL;
} else {
// mise à jour des liens entre pages
$wiki->SetPage($wiki->LoadPage($pagename,"",0));
$wiki->ClearLinkTable();
$wiki->StartLinkTracking();
$wiki->TrackLinkTo($pagename);
$wiki->StopLinkTracking();
$wiki->WriteLinkTable();
$wiki->ClearLinkTable();
}
}
}
}
}
?>
/trunk/jrest/services/Resume.php
1,107 → 1,108
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Resume extends ProjetService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
 
public function getElement($uid){
 
$id_utilisateur = $uid[0];
$mail_utilisateur = $uid[1];
 
// on selectionne les projets les plus actifs
$requete_projets = 'SELECT DISTINCT *'.
' FROM projet_statistiques'.
' WHERE ps_ce_projet'.
' IN '.
'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur).')'.
' GROUP BY ps_ce_projet'.
' ORDER BY ps_msg_derniere_semaine DESC';
$resume = array();
 
$resume['titre'] = 'Mes projets les plus actifs';
$resume['lien_appli'] = '<a href="http://www.tela-botanica.org/page:liste_projets"> Voir tous les projets </a>';
 
$projets = $this->bdd->query($requete_projets)->fetchAll();
 
if(!$projets) {
$resume['message'] = 'Vous n\'êtes inscrit à aucun projet';
} else {
foreach($projets as $projet) {
 
$requete_info_projet = 'SELECT p_titre'.
' FROM projet'.
' WHERE p_id = '.$this->bdd->quote($projet['ps_ce_projet']);
 
$projet_infos = $this->bdd->query($requete_info_projet)->fetchAll();
 
$infos_messages = '';
 
if($projet['ps_msg_derniere_semaine'] > 0) {
$infos_messages = ' (+ '.$projet['ps_msg_derniere_semaine'].' nouveaux messages) ';
} else {
$infos_messages = ' (aucun nouveau message) ';
}
 
$cible_lien = 'http://www.tela-botanica.org/page:liste_projets?id_projet='.$projet['ps_ce_projet'];
$resume_item = array('element' => $projet_infos[0]['p_titre'].$infos_messages, 'lien' => $cible_lien);
$resume['elements'][] = $resume_item;
}
}
 
$this->envoyer($resume);
}
 
public function gererInscription($id_utilisateur, $mail_utilisateur) {
 
$requete_projets_utilisateur = 'SELECT * FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur);
 
$resume = '';
$projets = $this->requeteTous($requete_projets_utilisateur);
 
if($projets <= 0) {
$resume = '<h3> Vous n\'êtes inscrit à aucun projet </h3>';
} else {
$resume = '<h3> Vos projets </h3>';
$resume .= '<ul id="liste_projets">';
foreach($projets as $projet) {
 
$requete_info_projet = 'SELECT *'.
' FROM projet'.
' WHERE p_id = '.$this->bdd->quote($projet['psu_id_projet']);
 
$projet_infos = $this->requeteUn($requete_info_projet);
$infos_messages = '';
 
$resume .= '<li>
<a href="http://www.tela-botanica.org/page:liste_projets?id_projet='.$projet_infos['p_id'].'" >'.
'<b>'.$projet_infos['p_titre'].'</b>
</a>
<a onclick="javascript:return confirm(\'Se désinscrire du projet ?\');" href="http://www.tela-botanica.org/page:mes_preferences_des_projets?id_projet=7&amp;act=26">
Se désinscrire du projet
</a>
</li>';
}
$resume .= '</ul>';
}
 
return $resume;
}
}
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Resume extends ProjetService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
 
public function getElement($uid){
 
$id_utilisateur = $uid[0];
$mail_utilisateur = $uid[1];
 
// on selectionne les projets les plus actifs
$requete_projets = 'SELECT DISTINCT *'.
' FROM projet_statistiques'.
' WHERE ps_ce_projet'.
' IN '.
'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur).')'.
' GROUP BY ps_ce_projet'.
' ORDER BY ps_msg_derniere_semaine DESC'.
' LIMIT 0,5';
$resume = array();
 
$resume['titre'] = 'Vos projets les plus actifs';
$resume['lien_appli'] = '<a href="http://www.tela-botanica.org/page:liste_projets"> Voir tous les projets </a>';
 
$projets = $this->bdd->query($requete_projets)->fetchAll();
 
if(!$projets) {
$resume['message'] = 'Vous n\'êtes inscrit à aucun projet';
} else {
foreach($projets as $projet) {
 
$requete_info_projet = 'SELECT p_titre'.
' FROM projet'.
' WHERE p_id = '.$this->bdd->quote($projet['ps_ce_projet']);
 
$projet_infos = $this->bdd->query($requete_info_projet)->fetchAll();
 
$infos_messages = '';
 
if($projet['ps_msg_derniere_semaine'] > 0) {
$infos_messages = ' (+ '.$projet['ps_msg_derniere_semaine'].' nouveaux messages) ';
} else {
$infos_messages = ' (aucun nouveau message) ';
}
 
$cible_lien = 'http://www.tela-botanica.org/page:liste_projets?id_projet='.$projet['ps_ce_projet'];
$resume_item = array('element' => $projet_infos[0]['p_titre'].$infos_messages, 'lien' => $cible_lien);
$resume['elements'][] = $resume_item;
}
}
 
$this->envoyer($resume);
}
 
public function gererInscription($id_utilisateur, $mail_utilisateur) {
 
$requete_projets_utilisateur = 'SELECT * FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur);
 
$resume = '';
$projets = $this->requeteTous($requete_projets_utilisateur);
 
if($projets <= 0) {
$resume = '<h3> Vous n\'êtes inscrit à aucun projet </h3>';
} else {
$resume = '<h3> Vos projets </h3>';
$resume .= '<ul id="liste_projets">';
foreach($projets as $projet) {
 
$requete_info_projet = 'SELECT *'.
' FROM projet'.
' WHERE p_id = '.$this->bdd->quote($projet['psu_id_projet']);
 
$projet_infos = $this->requeteUn($requete_info_projet);
$infos_messages = '';
 
$resume .= '<li>
<a href="http://www.tela-botanica.org/page:liste_projets?id_projet='.$projet_infos['p_id'].'" >'.
'<b>'.$projet_infos['p_titre'].'</b>
</a>
<a onclick="javascript:return confirm(\'Se désinscrire du projet ?\');" href="http://www.tela-botanica.org/page:mes_preferences_des_projets?id_projet=7&amp;act=26">
Se désinscrire du projet
</a>
</li>';
}
$resume .= '</ul>';
}
 
return $resume;
}
}
?>
/trunk/jrest/services/DesinscriptionProjet.php
1,45 → 1,45
<?php
 
Class DesinscriptionProjet extends ProjetService {
public function getElement($uid) {
 
$id_utilisateur = (isset($_GET['id_utilisateur'])) ? $_GET['id_utilisateur'] : false;
$mail = (isset($_GET['mail'])) ? $_GET['mail'] : false;
$id_projet = (isset($_GET['id_projet'])) ? $_GET['id_projet'] : false;
 
if(!$id_utilisateur || !$id_projet) {
return false;
}
 
// et on le supprime du projet
$suppression_participant = $this->supprimerParticipantAProjet($id_utilisateur, $id_projet);
 
// ainsi que des listes associées
if($mail) {
$listes = $this->obtenirListesAssocieesAuProjet($id_projet);
// si pas de liste, rien à faire
if(count($listes) <= 0) {
continue;
}
 
$nom_liste = $listes[0]['pl_nom_liste'];
$id_liste = $listes[0]['pl_id_liste'];
$suppression_liste = $this->supprimerInscriptionAListeProjet($id_utilisateur, $id_liste);
 
// on supprime l'abonnement
if($this->estAbonneAListe($nom_liste, $mail)) {
if(!$this->desinscriptionListe($nom_liste, $mail)) {
$this->envoyer("false");
}
}
}
 
$this->envoyer("OK");
return;
}
}
 
<?php
 
Class DesinscriptionProjet extends ProjetService {
public function getElement($uid) {
 
$id_utilisateur = (isset($_GET['id_utilisateur'])) ? $_GET['id_utilisateur'] : false;
$mail = (isset($_GET['mail'])) ? $_GET['mail'] : false;
$id_projet = (isset($_GET['id_projet'])) ? $_GET['id_projet'] : false;
 
if(!$id_utilisateur || !$id_projet) {
return false;
}
 
// et on le supprime du projet
$suppression_participant = $this->supprimerParticipantAProjet($id_utilisateur, $id_projet);
 
// ainsi que des listes associées
if($mail) {
$listes = $this->obtenirListesAssocieesAuProjet($id_projet);
// si pas de liste, rien à faire
if(count($listes) <= 0) {
continue;
}
 
$nom_liste = $listes[0]['pl_nom_liste'];
$id_liste = $listes[0]['pl_id_liste'];
$suppression_liste = $this->supprimerInscriptionAListeProjet($id_utilisateur, $id_liste);
 
// on supprime l'abonnement
if($this->estAbonneAListe($nom_liste, $mail)) {
if(!$this->desinscriptionListe($nom_liste, $mail)) {
$this->envoyer("false");
}
}
}
 
$this->envoyer("OK");
return;
}
}
 
?>
/trunk/jrest/services/Documents.php
1,65 → 1,63
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Documents extends ProjetService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
 
public function getElement($uid){
$id_utilisateur = $uid[1];
$mail_utilisateur = $uid[2];
if($id_utilisateur == "") {
return;
}
 
// on selectionne les projets les plus actifs
$requete_docs_projets = 'SELECT * FROM projet_documents WHERE pd_ce_utilisateur = '.$this->bdd->quote($id_utilisateur).' '.
'AND pd_ce_type != 0 AND pd_visibilite = "public" '.
'ORDER BY pd_date_de_mise_a_jour DESC '.
'LIMIT 0,5';
$resume = array();
 
$resume['titre'] = 'Mes derniers documents déposés';
//$resume['lien_appli'] = '<a href="http://www.tela-botanica.org/page:liste_projets"> Voir tous les projets </a>';
 
$docs = $this->bdd->query($requete_docs_projets)->fetchAll();
 
if(!$docs) {
$resume['message'] = 'Vous n\'avez déposé aucun document';
} else {
foreach($docs as $doc) {
$infos_projet = $this->obtenirInformationsProjet($doc['pd_ce_projet']);
//print_r($infos_projet);
$nom_projet = $infos_projet[0]['p_titre'];
$date_formatee = strftime( "%d/%m/%Y" , strtotime( $doc['pd_date_de_mise_a_jour'] ) );
 
$infos_messages = ' ('.$nom_projet.' le '.$date_formatee.') ';
$cible_lien = 'http://www.tela-botanica.org/projets/'.$doc['pd_ce_projet'].'/telechargement/'.$doc['pd_id'];
$resume_item = array('element' => $doc['pd_nom'].$infos_messages, 'lien' => $cible_lien);
$resume['elements'][] = $resume_item;
}
}
 
$this->envoyer($resume);
}
}
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Documents extends ProjetService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
 
public function getElement($uid){
$id_utilisateur = $uid[1];
$mail_utilisateur = $uid[2];
if($id_utilisateur == "") {
return;
}
 
// on selectionne les projets les plus actifs
$requete_docs_projets = 'SELECT * FROM projet_documents WHERE pd_ce_utilisateur = '.$this->bdd->quote($id_utilisateur).' '.
'AND pd_ce_type != 0 AND pd_visibilite = "public" '.
'ORDER BY pd_date_de_mise_a_jour DESC '.
'LIMIT 0,5';
$resume = array();
 
$resume['titre'] = 'Vos derniers documents déposés';
//$resume['lien_appli'] = '<a href="http://www.tela-botanica.org/page:liste_projets"> Voir tous les projets </a>';
 
$docs = $this->bdd->query($requete_docs_projets)->fetchAll();
 
if(!$docs) {
$resume['message'] = 'Vous n\'avez déposé aucun document';
} else {
foreach($docs as $doc) {
$infos_projet = $this->obtenirInformationsProjet($doc['pd_ce_projet']);
$nom_projet = $infos_projet[0]['p_titre'];
$date_formatee = strftime( "%d/%m/%Y" , strtotime( $doc['pd_date_de_mise_a_jour'] ) );
 
$infos_messages = ' ('.$nom_projet.' le '.$date_formatee.') ';
$cible_lien = 'http://www.tela-botanica.org/projets/'.$doc['pd_ce_projet'].'/telechargement/'.$doc['pd_id'];
$resume_item = array('element' => $doc['pd_nom'].$infos_messages, 'lien' => $cible_lien);
$resume['elements'][] = $resume_item;
}
}
 
$this->envoyer($resume);
}
}
?>
/trunk/jrest/services/Inscription.php
1,21 → 1,21
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Inscription extends JRestService {
 
public function getElement($uid){
 
$this->envoyer("OK");
}
}
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Inscription extends JRestService {
 
public function getElement($uid){
 
$this->envoyer("OK");
}
}
?>
/trunk/jrest/services/ProjetService.php
1,149 → 1,174
<?php
/**
* PHP Version 5
*
* @category PHP
* @package projet_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/projet_bp/
*/
 
class ProjetService extends JRestService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
 
protected function obtenirProjetsPourParticipant($id_utilisateur) {
 
// on selectionne la liste des projets auxquel on est inscrit
$requete_projets = 'SELECT DISTINCT *'.
' FROM projet'.
' WHERE p_id'.
' IN '.
'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur).')'.
' GROUP BY p_id';
 
try {
$projets = $this->bdd->query($requete_projets)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return array();
}
 
// pas de projets ? alors c'est fait !
if(!$projets || count($projets) <= 0) {
return array();
}
 
return $projets;
}
protected function obtenirInformationsProjet($id_projet) {
$requete_informations_projet = 'SELECT DISTINCT *'.
' FROM projet'.
' WHERE p_id = '.$this->bdd->quote($id_projet) ;
try {
$projet = $this->bdd->query($requete_informations_projet)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return false;
}
 
// pas de projets ? alors c'est fait !
if(!$projet) {
return false;
}
 
return $projet;
}
 
protected function obtenirListesAssocieesAuProjet($id_projet) {
 
$requete_liste_projets = 'SELECT * FROM projet_liste '.
'WHERE pl_id_liste IN '.
'(SELECT pl_id_liste from projet_lien_liste '.
'WHERE pl_id_projet='.$this->bdd->quote($id_projet).')' ;
 
try {
$listes_projets = $this->bdd->query($requete_liste_projets)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return array();
}
 
 
if(!$listes_projets || count($listes_projets) <= 0) {
return array();
}
 
return $listes_projets;
}
protected function supprimerInscriptionAListeProjet($id_utilisateur, $id_liste) {
$requete_suppression_liste = 'DELETE FROM projet_inscription_liste '.
'WHERE pil_id_utilisateur='.$this->bdd->quote($id_utilisateur).' and pil_id_liste='.$this->bdd->quote($id_liste) ;
 
try {
$requete_suppression_liste = $this->bdd->query($requete_suppression_liste);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_liste);
return false;
}
}
 
protected function supprimerParticipantAProjet($id_utilisateur, $id_projet) {
$requete_suppression_projets = 'DELETE FROM projet_statut_utilisateurs '.
'WHERE psu_id_utilisateur='.$this->bdd->quote($id_utilisateur).' and psu_id_projet='.$this->bdd->quote($id_projet) ;
 
try {
$requete_suppression_projets = $this->bdd->query($requete_suppression_projets);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_projets);
return false;
}
return true;
}
 
protected function estAbonneAListe($nom_liste, $mail) {
 
try {
$est_abonne = '0' ;
$xml_abonne = new SimpleXMLElement(file_get_contents('http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail)) ;
$est_abonne = $xml_abonne[0] ;
 
if($est_abonne == '1') {
return true;
} else {
return false;
}
}
catch(Exception $e) {
trigger_error($e->getMessage()) ;
return false;
}
 
}
 
protected function modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail) {
return ($this->desinscriptionListe($nom_liste, $ancien_mail) && $this->inscriptionListe($nom_liste, $nouveau_mail));
}
 
protected function inscriptionListe($nom_liste, $mail) {
return $inscription_abonne = file_get_contents('http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
}
 
protected function desinscriptionListe($nom_liste, $mail) {
return $suppression_abonne = file_get_contents('http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
}
}
?>
<?php
/**
* PHP Version 5
*
* @category PHP
* @package projet_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/projet_bp/
*/
 
class ProjetService extends JRestService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
 
protected function obtenirProjetsPourParticipant($id_utilisateur) {
 
// on selectionne la liste des projets auxquel on est inscrit
$requete_projets = 'SELECT DISTINCT *'.
' FROM projet'.
' WHERE p_id'.
' IN '.
'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur).')'.
' GROUP BY p_id';
 
try {
$projets = $this->bdd->query($requete_projets)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return array();
}
 
// pas de projets ? alors c'est fait !
if(!$projets || count($projets) <= 0) {
return array();
}
 
return $projets;
}
protected function obtenirInformationsProjet($id_projet) {
$requete_informations_projet = 'SELECT DISTINCT *'.
' FROM projet'.
' WHERE p_id = '.$this->bdd->quote($id_projet) ;
try {
$projet = $this->bdd->query($requete_informations_projet)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return false;
}
 
// pas de projets ? alors c'est fait !
if(!$projet) {
return false;
}
 
return $projet;
}
 
protected function obtenirListesAssocieesAuProjet($id_projet) {
 
$requete_liste_projets = 'SELECT * FROM projet_liste '.
'WHERE pl_id_liste IN '.
'(SELECT pl_id_liste from projet_lien_liste '.
'WHERE pl_id_projet='.$this->bdd->quote($id_projet).')' ;
 
try {
$listes_projets = $this->bdd->query($requete_liste_projets)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return array();
}
 
 
if(!$listes_projets || count($listes_projets) <= 0) {
return array();
}
 
return $listes_projets;
}
protected function obtenirListesExternesAssocieesAuProjet($id_projet) {
 
$requete_liste_projets = 'SELECT * FROM agora '.
'WHERE plle_id_liste IN '.
'(SELECT plle_id_liste from projet_lien_liste_externe '.
'WHERE plle_id_projet='.$this->bdd->quote($id_projet).')' ;
 
try {
$listes_projets = $this->bdd->query($requete_liste_projets)->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
return array();
}
 
 
if(!$listes_projets || count($listes_projets) <= 0) {
return array();
}
 
return $listes_projets;
}
protected function supprimerInscriptionAListeProjet($id_utilisateur, $id_liste) {
$requete_suppression_liste = 'DELETE FROM projet_inscription_liste '.
'WHERE pil_id_utilisateur='.$this->bdd->quote($id_utilisateur).' and pil_id_liste='.$this->bdd->quote($id_liste);
 
try {
$requete_suppression_liste = $this->bdd->query($requete_suppression_liste);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_liste);
return false;
}
}
 
protected function supprimerParticipantAProjet($id_utilisateur, $id_projet) {
$requete_suppression_projets = 'DELETE FROM projet_statut_utilisateurs '.
'WHERE psu_id_utilisateur='.$this->bdd->quote($id_utilisateur).' and psu_id_projet='.$this->bdd->quote($id_projet);
 
try {
$requete_suppression_projets = $this->bdd->query($requete_suppression_projets);
} catch (PDOException $e) {
Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_projets);
return false;
}
return true;
}
 
protected function estAbonneAListe($nom_liste, $mail) {
 
try {
$est_abonne = '0' ;
// TODO: externaliser l'adresse
$xml_abonne = new SimpleXMLElement(file_get_contents('http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail)) ;
$est_abonne = $xml_abonne[0] ;
 
if($est_abonne == '1') {
return true;
} else {
return false;
}
}
catch(Exception $e) {
trigger_error($e->getMessage()) ;
return false;
}
 
}
 
protected function modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail) {
return ($this->desinscriptionListe($nom_liste, $ancien_mail) && $this->inscriptionListe($nom_liste, $nouveau_mail));
}
 
protected function inscriptionListe($nom_liste, $mail) {
// TODO: externaliser l'adresse
return $inscription_abonne = file_get_contents('http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
}
 
protected function desinscriptionListe($nom_liste, $mail) {
// TODO: externaliser l'adresse
return $suppression_abonne = file_get_contents('http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
}
}
?>
/trunk/jrest/services/Modification.php
1,69 → 1,69
<?php
/**
* PHP Version 5
*
* @category PHP
* @package projet_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/projet_bp/
*/
 
 
class Modification extends ProjetService {
 
public function getElement($uid){
 
$id_utilisateur = (isset($_GET['id_utilisateur'])) ? $_GET['id_utilisateur'] : false;
$mail = (isset($_GET['mail'])) ? $_GET['mail'] : false;
$nouveau_mail = (isset($_GET['nouveau_mail'])) ? $_GET['nouveau_mail'] : false;
 
if(!$mail || !$id_utilisateur) {
$this->envoyer("false");
}
 
$ancien_mail = $mail;
$nouveau_mail = $nouveau_mail;
 
// si le mail n'a pas changé, on ne change rien
if($ancien_mail == $nouveau_mail) {
$this->envoyer("OK");
return;
}
 
$projets = $this->obtenirProjetsPourParticipant($id_utilisateur);
 
// si pas de projets, rien à faire
if(count($projets) <= 0) {
$this->envoyer("OK");
return;
}
 
// sinon on récupère la liste associée à chaque projet
foreach($projets as $projet) {
 
$id_projet = $projet['p_id'];
$listes = $this->obtenirListesAssocieesAuProjet($id_projet);
 
// si pas de liste, rien à faire
if(count($listes) <= 0) {
continue;
}
 
$nom_liste = $listes[0]['pl_nom_liste'];
 
// on modifie l'abonnement
if($this->estAbonneAListe($nom_liste, $mail)) {
if(!$this->modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail)) {
$this->envoyer("false");
}
}
}
 
$this->envoyer("OK");
return;
}
}
?>
<?php
/**
* PHP Version 5
*
* @category PHP
* @package projet_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/projet_bp/
*/
 
 
class Modification extends ProjetService {
 
public function getElement($uid){
 
$id_utilisateur = (isset($_GET['id_utilisateur'])) ? $_GET['id_utilisateur'] : false;
$mail = (isset($_GET['mail'])) ? $_GET['mail'] : false;
$nouveau_mail = (isset($_GET['nouveau_mail'])) ? $_GET['nouveau_mail'] : false;
 
if(!$mail || !$id_utilisateur) {
$this->envoyer("false");
}
 
$ancien_mail = $mail;
$nouveau_mail = $nouveau_mail;
 
// si le mail n'a pas changé, on ne change rien
if($ancien_mail == $nouveau_mail) {
$this->envoyer("OK");
return;
}
 
$projets = $this->obtenirProjetsPourParticipant($id_utilisateur);
 
// si pas de projets, rien à faire
if(count($projets) <= 0) {
$this->envoyer("OK");
return;
}
 
// sinon on récupère la liste associée à chaque projet
foreach($projets as $projet) {
 
$id_projet = $projet['p_id'];
$listes = $this->obtenirListesAssocieesAuProjet($id_projet);
 
// si pas de liste, rien à faire
if(count($listes) <= 0) {
continue;
}
 
$nom_liste = $listes[0]['pl_nom_liste'];
 
// on modifie l'abonnement
if($this->estAbonneAListe($nom_liste, $mail)) {
if(!$this->modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail)) {
$this->envoyer("false");
}
}
}
 
$this->envoyer("OK");
return;
}
}
?>
/trunk/jrest/services/Gestion.php
1,52 → 1,52
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Gestion extends JRestService {
 
public function getElement($uid){
 
$id_utilisateur = $uid[0];
$mail_utilisateur = $uid[1];
 
// on selectionne la liste des projets auxquel on est inscrit
$requete_projets = 'SELECT DISTINCT *'.
' FROM projet'.
' WHERE p_id'.
' IN '.
'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur).')'.
' GROUP BY p_id';
 
$resume = array();
 
$resume['titre'] = 'Gestion de mes projets';
$resume['info'] = 'Vous souhaitez vous inscrire à d\'autres projets ? <a href="http://www.tela-botanica.org/page:liste_projets" > Consultez la liste des projets et forums </a>';
 
$projets = $this->bdd->query($requete_projets)->fetchAll();
 
if(!$projets) {
$resume['message'] = 'Vous n\'&ecirc;tes inscrit &agrave; aucun projet';
} else {
foreach($projets as $projet) {
 
$cible_lien_desinscrire = 'http://www.tela-botanica.org/client/projet/jrest/DesinscriptionProjet/?id_projet='.$projet['p_id'].'&id_utilisateur='.$id_utilisateur.'&mail='.$mail_utilisateur;
$cible_lien = 'http://www.tela-botanica.org/page:liste_projets?id_projet='.$projet['p_id'];
$resume_item = array('element' => $projet['p_titre'], 'lien_desinscrire' => $cible_lien_desinscrire, 'lien' => $cible_lien, 'intitule_lien' => 'Se d&eacute;sinscrire');
$resume['elements'][] = $resume_item;
}
}
 
$this->envoyer($resume);
}
}
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class Gestion extends JRestService {
 
public function getElement($uid){
 
$id_utilisateur = $uid[0];
$mail_utilisateur = $uid[1];
 
// on selectionne la liste des projets auxquel on est inscrit
$requete_projets = 'SELECT DISTINCT *'.
' FROM projet'.
' WHERE p_id'.
' IN '.
'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.
' WHERE psu_id_utilisateur = '.$this->bdd->quote($id_utilisateur).')'.
' GROUP BY p_id';
 
$resume = array();
 
$resume['titre'] = 'Gestion de mes projets';
$resume['info'] = 'Vous souhaitez vous inscrire à d\'autres projets ? <a href="http://www.tela-botanica.org/page:liste_projets" > Consultez la liste des projets et forums </a>';
 
$projets = $this->bdd->query($requete_projets)->fetchAll();
 
if(!$projets) {
$resume['message'] = 'Vous n\'&ecirc;tes inscrit &agrave; aucun projet';
} else {
foreach($projets as $projet) {
 
$cible_lien_desinscrire = 'http://www.tela-botanica.org/client/projet/jrest/DesinscriptionProjet/?id_projet='.$projet['p_id'].'&id_utilisateur='.$id_utilisateur.'&mail='.$mail_utilisateur;
$cible_lien = 'http://www.tela-botanica.org/page:liste_projets?id_projet='.$projet['p_id'];
$resume_item = array('element' => $projet['p_titre'], 'lien_desinscrire' => $cible_lien_desinscrire, 'lien' => $cible_lien, 'intitule_lien' => 'Se d&eacute;sinscrire');
$resume['elements'][] = $resume_item;
}
}
 
$this->envoyer($resume);
}
}
?>
/trunk/jrest/services/JRestService.php
1,238 → 1,238
<?php
/**
* Classe mère abstraite contenant les méthodes génériques des services.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2009
*/
abstract class JRestService {
 
public $config;
protected $bdd;
protected $log = array();
protected $messages = array();
protected $debug = array();
protected $distinct = false;
protected $orderby = null;
protected $formatRetour = 'objet';
protected $start = 0;
protected $limit = 150;
 
public function __construct($config, $demarrer_session = true) {
// Tableau contenant la config de Jrest
$this->config = $config;
 
// Connection à la base de données
$this->bdd = $this->connecterPDO($this->config, 'appli');
 
// Nettoyage du $_GET (sécurité)
if (isset($_GET)) {
$get_params = array('orderby', 'distinct', 'start', 'limit', 'formatRetour');
foreach ($get_params as $get) {
$verifier = array('NULL', "\n", "\r", "\\", "'", '"', "\x00", "\x1a", ';');
$_GET[$get] = str_replace($verifier, '', $_GET[$get]);
if (isset($_GET[$get]) && $_GET[$get] != '') {
$this->$get = $_GET[$get];
} else {
$_GET[$get] = null;
}
}
}
}
 
/**
* Méthode appelée quand aucun paramètre n'est passé dans l'url et avec une requête de type GET.
*/
public function getRessource() {
$this->getElement(array());
}
 
protected function envoyer($donnees = null, $mime = 'text/html', $encodage = 'utf-8', $json = true) {
// Traitements des messages d'erreurs et données
if (count($this->messages) != 0) {
header('HTTP/1.1 500 Internal Server Error');
$mime = 'text/html';
$encodage = 'utf-8';
$json = true;
$sortie = $this->messages;
} else {
$sortie = $donnees;
if (is_null($donnees)) {
$sortie = 'OK';
}
}
 
// Gestion de l'envoie du déboguage
$this->envoyerDebogage();
 
// Encodage au format et JSON et envoie sur la sortie standard
$contenu = $json ? json_encode($sortie) : $sortie;
$this->envoyerContenu($encodage, $mime, $contenu);
}
 
protected function envoyerDebogage() {
if (!is_array($this->debug)) {
$this->debug[] = $this->debug;
}
if (count($this->debug) != 0) {
foreach ($this->debug as $cle => $val) {
if (is_array($val)) {
$this->debug[$cle] = print_r($val, true);
}
}
header('X-DebugJrest-Data:'.json_encode($this->debug));
}
}
 
protected function envoyerContenu($encodage, $mime, $contenu) {
header("Content-Type: $mime; charset=$encodage");
print $contenu;
}
 
private function connecterPDO($config, $base = 'database') {
$cfg = $config[$base];
$dsn = $cfg['phptype'].':dbname='.$cfg['database'].';host='.$cfg['hostspec'];
try {
$PDO = new PDO($dsn, $cfg['username'], $cfg['password']);
} catch (PDOException $e) {
echo 'La connexion à la base de donnée via PDO a échouée : ' . $e->getMessage();
}
// Passe en UTF-8 la connexion à la BDD
$PDO->exec("SET NAMES 'utf8'");
// Affiche les erreurs détectées par PDO (sinon mode silencieux => aucune erreur affiché)
$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $PDO;
}
 
protected function getTxt($id) {
$sortie = '';
switch ($id) {
case 'sql_erreur' : $sortie = 'Requête echec. Fichier : "%s". Ligne : "%s". Message : %s'; break;
default : $sortie = $id;
}
return $sortie;
}
 
protected function traiterParametresUrl($params_attendu, $params, $pourBDD = true) {
$sortie = array();
foreach ($params_attendu as $num => $nom) {
if (isset($params[$num]) && $params[$num] != '*') {
if ($pourBDD) {
$params[$num] = $this->bdd->quote($params[$num]);
}
$sortie[$nom] = $params[$num];
}
}
return $sortie;
}
 
protected function traiterParametresPost($params) {
$sortie = array();
foreach ($params as $cle => $valeur) {
$sortie[$cle] = $this->bdd->quote($valeur);
}
return $sortie;
}
 
protected function getIdentification(&$params) {
// Initialisation des variables
$utilisateur = array(0, session_id());
 
// L'id utilisateur est soit passé par le POST soit dans l'url
if (is_array($params) && isset($params['cmhl_ce_modifier_par'])) {
$utilisateur[0] = $params['cmhl_ce_modifier_par'];
unset($params['cmhl_ce_modifier_par']);
} else if (is_string($params)) {
$utilisateur[0] = $params;
}
 
return $utilisateur;
}
 
protected function etreAutorise($id_utilisateur) {
$autorisation = false;
if (($_SESSION['coel_utilisateur'] != '') && $_SESSION['coel_utilisateur']['id'] != $id_utilisateur) {
$this->messages[] = 'Accès interdit.';
} else if ($_SESSION['coel_utilisateur'] == '') {
$this->messages[] = 'Veuillez vous identifiez pour accéder à cette fonction.';
} else {
$autorisation = true;
}
return $autorisation;
}
 
private function gererIdentificationPermanente() {
// Pour maintenir l'utilisateur tjrs réellement identifié nous sommes obligé de recréer une SESSION et de le recharger depuis la bdd
if ($this->getUtilisateur() == ''
&& isset($_COOKIE['coel_login'])
&& ($utilisateur = $this->chargerUtilisateur($_COOKIE['coel_login'], $_COOKIE['coel_mot_de_passe']))) {
$this->setUtilisateur($utilisateur, $_COOKIE['coel_permanence']);
}
}
 
protected function getUtilisateur() {
return (isset($_SESSION['coel_utilisateur']) ? $_SESSION['coel_utilisateur'] : '');
}
 
/**
* Méthode prenant en paramètre un chemin de fichier squelette et un tableau associatif de données,
* en extrait les variables, charge le squelette et retourne le résultat des deux combinés.
*
* @param String $fichier le chemin du fichier du squelette
* @param Array $donnees un tableau associatif contenant les variables a injecter dans le squelette.
*
* @return boolean false si le squelette n'existe pas, sinon la chaine résultat.
*/
public static function traiterSquelettePhp($fichier, Array $donnees = array()) {
$sortie = false;
if (file_exists($fichier)) {
// Extraction des variables du tableau de données
extract($donnees);
// Démarage de la bufferisation de sortie
ob_start();
// Si les tags courts sont activés
if ((bool) @ini_get('short_open_tag') === true) {
// Simple inclusion du squelette
include $fichier;
} else {
// Sinon, remplacement des tags courts par la syntaxe classique avec echo
$html_et_code_php = self::traiterTagsCourts($fichier);
// Pour évaluer du php mélangé dans du html il est nécessaire de fermer la balise php ouverte par eval
$html_et_code_php = '?>'.$html_et_code_php;
// Interprétation du html et du php dans le buffer
echo eval($html_et_code_php);
}
// Récupèration du contenu du buffer
$sortie = ob_get_contents();
// Suppression du buffer
@ob_end_clean();
} else {
$msg = "Le fichier du squelette '$fichier' n'existe pas.";
trigger_error($msg, E_USER_WARNING);
}
// Retourne le contenu
return $sortie;
}
 
/**
* Fonction chargeant le contenu du squelette et remplaçant les tags court php (<?= ...) par un tag long avec echo.
*
* @param String $chemin_squelette le chemin du fichier du squelette
*
* @return string le contenu du fichier du squelette php avec les tags courts remplacés.
*/
private static function traiterTagsCourts($chemin_squelette) {
$contenu = file_get_contents($chemin_squelette);
// Remplacement de tags courts par un tag long avec echo
$contenu = str_replace('<?=', '<?php echo ', $contenu);
// Ajout systématique d'un point virgule avant la fermeture php
$contenu = preg_replace("/;*\s*\?>/", "; ?>", $contenu);
return $contenu;
}
}
<?php
/**
* Classe mère abstraite contenant les méthodes génériques des services.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2009
*/
abstract class JRestService {
 
public $config;
protected $bdd;
protected $log = array();
protected $messages = array();
protected $debug = array();
protected $distinct = false;
protected $orderby = null;
protected $formatRetour = 'objet';
protected $start = 0;
protected $limit = 150;
 
public function __construct($config, $demarrer_session = true) {
// Tableau contenant la config de Jrest
$this->config = $config;
 
// Connection à la base de données
$this->bdd = $this->connecterPDO($this->config, 'appli');
 
// Nettoyage du $_GET (sécurité)
if (isset($_GET)) {
$get_params = array('orderby', 'distinct', 'start', 'limit', 'formatRetour');
foreach ($get_params as $get) {
$verifier = array('NULL', "\n", "\r", "\\", "'", '"', "\x00", "\x1a", ';');
$_GET[$get] = str_replace($verifier, '', $_GET[$get]);
if (isset($_GET[$get]) && $_GET[$get] != '') {
$this->$get = $_GET[$get];
} else {
$_GET[$get] = null;
}
}
}
}
 
/**
* Méthode appelée quand aucun paramètre n'est passé dans l'url et avec une requête de type GET.
*/
public function getRessource() {
$this->getElement(array());
}
 
protected function envoyer($donnees = null, $mime = 'text/html', $encodage = 'utf-8', $json = true) {
// Traitements des messages d'erreurs et données
if (count($this->messages) != 0) {
header('HTTP/1.1 500 Internal Server Error');
$mime = 'text/html';
$encodage = 'utf-8';
$json = true;
$sortie = $this->messages;
} else {
$sortie = $donnees;
if (is_null($donnees)) {
$sortie = 'OK';
}
}
 
// Gestion de l'envoie du déboguage
$this->envoyerDebogage();
 
// Encodage au format et JSON et envoie sur la sortie standard
$contenu = $json ? json_encode($sortie) : $sortie;
$this->envoyerContenu($encodage, $mime, $contenu);
}
 
protected function envoyerDebogage() {
if (!is_array($this->debug)) {
$this->debug[] = $this->debug;
}
if (count($this->debug) != 0) {
foreach ($this->debug as $cle => $val) {
if (is_array($val)) {
$this->debug[$cle] = print_r($val, true);
}
}
header('X-DebugJrest-Data:'.json_encode($this->debug));
}
}
 
protected function envoyerContenu($encodage, $mime, $contenu) {
header("Content-Type: $mime; charset=$encodage");
print $contenu;
}
 
private function connecterPDO($config, $base = 'database') {
$cfg = $config[$base];
$dsn = $cfg['phptype'].':dbname='.$cfg['database'].';host='.$cfg['hostspec'];
try {
$PDO = new PDO($dsn, $cfg['username'], $cfg['password']);
} catch (PDOException $e) {
echo 'La connexion à la base de donnée via PDO a échouée : ' . $e->getMessage();
}
// Passe en UTF-8 la connexion à la BDD
$PDO->exec("SET NAMES 'utf8'");
// Affiche les erreurs détectées par PDO (sinon mode silencieux => aucune erreur affiché)
$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $PDO;
}
 
protected function getTxt($id) {
$sortie = '';
switch ($id) {
case 'sql_erreur' : $sortie = 'Requête echec. Fichier : "%s". Ligne : "%s". Message : %s'; break;
default : $sortie = $id;
}
return $sortie;
}
 
protected function traiterParametresUrl($params_attendu, $params, $pourBDD = true) {
$sortie = array();
foreach ($params_attendu as $num => $nom) {
if (isset($params[$num]) && $params[$num] != '*') {
if ($pourBDD) {
$params[$num] = $this->bdd->quote($params[$num]);
}
$sortie[$nom] = $params[$num];
}
}
return $sortie;
}
 
protected function traiterParametresPost($params) {
$sortie = array();
foreach ($params as $cle => $valeur) {
$sortie[$cle] = $this->bdd->quote($valeur);
}
return $sortie;
}
 
protected function getIdentification(&$params) {
// Initialisation des variables
$utilisateur = array(0, session_id());
 
// L'id utilisateur est soit passé par le POST soit dans l'url
if (is_array($params) && isset($params['cmhl_ce_modifier_par'])) {
$utilisateur[0] = $params['cmhl_ce_modifier_par'];
unset($params['cmhl_ce_modifier_par']);
} else if (is_string($params)) {
$utilisateur[0] = $params;
}
 
return $utilisateur;
}
 
protected function etreAutorise($id_utilisateur) {
$autorisation = false;
if (($_SESSION['coel_utilisateur'] != '') && $_SESSION['coel_utilisateur']['id'] != $id_utilisateur) {
$this->messages[] = 'Accès interdit.';
} else if ($_SESSION['coel_utilisateur'] == '') {
$this->messages[] = 'Veuillez vous identifiez pour accéder à cette fonction.';
} else {
$autorisation = true;
}
return $autorisation;
}
 
private function gererIdentificationPermanente() {
// Pour maintenir l'utilisateur tjrs réellement identifié nous sommes obligé de recréer une SESSION et de le recharger depuis la bdd
if ($this->getUtilisateur() == ''
&& isset($_COOKIE['coel_login'])
&& ($utilisateur = $this->chargerUtilisateur($_COOKIE['coel_login'], $_COOKIE['coel_mot_de_passe']))) {
$this->setUtilisateur($utilisateur, $_COOKIE['coel_permanence']);
}
}
 
protected function getUtilisateur() {
return (isset($_SESSION['coel_utilisateur']) ? $_SESSION['coel_utilisateur'] : '');
}
 
/**
* Méthode prenant en paramètre un chemin de fichier squelette et un tableau associatif de données,
* en extrait les variables, charge le squelette et retourne le résultat des deux combinés.
*
* @param String $fichier le chemin du fichier du squelette
* @param Array $donnees un tableau associatif contenant les variables a injecter dans le squelette.
*
* @return boolean false si le squelette n'existe pas, sinon la chaine résultat.
*/
public static function traiterSquelettePhp($fichier, Array $donnees = array()) {
$sortie = false;
if (file_exists($fichier)) {
// Extraction des variables du tableau de données
extract($donnees);
// Démarage de la bufferisation de sortie
ob_start();
// Si les tags courts sont activés
if ((bool) @ini_get('short_open_tag') === true) {
// Simple inclusion du squelette
include $fichier;
} else {
// Sinon, remplacement des tags courts par la syntaxe classique avec echo
$html_et_code_php = self::traiterTagsCourts($fichier);
// Pour évaluer du php mélangé dans du html il est nécessaire de fermer la balise php ouverte par eval
$html_et_code_php = '?>'.$html_et_code_php;
// Interprétation du html et du php dans le buffer
echo eval($html_et_code_php);
}
// Récupèration du contenu du buffer
$sortie = ob_get_contents();
// Suppression du buffer
@ob_end_clean();
} else {
$msg = "Le fichier du squelette '$fichier' n'existe pas.";
trigger_error($msg, E_USER_WARNING);
}
// Retourne le contenu
return $sortie;
}
 
/**
* Fonction chargeant le contenu du squelette et remplaçant les tags court php (<?= ...) par un tag long avec echo.
*
* @param String $chemin_squelette le chemin du fichier du squelette
*
* @return string le contenu du fichier du squelette php avec les tags courts remplacés.
*/
private static function traiterTagsCourts($chemin_squelette) {
$contenu = file_get_contents($chemin_squelette);
// Remplacement de tags courts par un tag long avec echo
$contenu = str_replace('<?=', '<?php echo ', $contenu);
// Ajout systématique d'un point virgule avant la fermeture php
$contenu = preg_replace("/;*\s*\?>/", "; ?>", $contenu);
return $contenu;
}
}
?>
/trunk/jrest/services/DocumentsRss.php
1,81 → 1,81
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class DocumentsRss extends ProjetService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
// TODO: gérer plusieurs format et utiliser les mêmes classes communes que
// celles du cel
public function getElement($uid){
$format = 'rss2';
 
// on selectionne les projets les plus actifs
$requete_docs_projets = 'SELECT * FROM projet_documents '.
'WHERE pd_ce_type != 0 AND pd_visibilite = "public" '.
'ORDER BY pd_date_de_mise_a_jour DESC '.
'LIMIT 0,5';
$resume = array();
 
$titre = htmlspecialchars('Derniers documents publics ');
$lien = 'http://www.tela-botanica.org/page:liste_projets';
 
$docs = $this->bdd->query($requete_docs_projets)->fetchAll();
$rss = '<?xml version="1.0" encoding="UTF-8"?>'.
'<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>'.$titre.'</title>
<link>'.$lien.'</link>
<atom:link href="" rel="self" type="application/rss+xml" />
<description>'.$titre.'</description>';
foreach($docs as $doc) {
$infos_projet = $this->obtenirInformationsProjet($doc['pd_ce_projet']);
$date_modification_timestamp = strtotime($doc['pd_date_de_mise_a_jour']);
$date_maj_doc = date(DATE_RSS, $date_modification_timestamp);
$nom_projet = 'Dans le projet '.$infos_projet[0]['p_titre'];
$id_doc = $doc['pd_id'];
$nom_doc = $doc['pd_nom'];
$description = preg_replace('/&(?!(a-z+|#0-9+|#x0-9a-f+);)/i', '&amp;', $nom_projet);
$description = preg_replace('/000null/i', '', $nom_projet);
$description = htmlspecialchars($description);
$lien_doc = 'http://www.tela-botanica.org/projets/'.$doc['pd_ce_projet'].'/telechargement/'.$doc['pd_id'];
$rss .='<item>
<guid>'.$id_doc.'</guid>
<title>'.$nom_doc.'</title>
<link>'.$lien_doc.'</link>
<description>'.$description.'</description>
<category>Document</category>
<pubDate>'.$date_maj_doc.'</pubDate>
</item>';
}
$rss .= '</channel>'.
'</rss>';
 
echo $rss;
}
}
<?php
/**
* PHP Version 5
*
* @category PHP
* @package papyrus_bp
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/papyrus_bp/
*/
 
Class DocumentsRss extends ProjetService {
public function __construct($config, $demarrer_session= true) {
parent::__construct($config, $demarrer_session);
}
// TODO: gérer plusieurs format et utiliser les mêmes classes communes que
// celles du cel
public function getElement($uid){
$format = 'rss2';
 
// on selectionne les projets les plus actifs
$requete_docs_projets = 'SELECT * FROM projet_documents '.
'WHERE pd_ce_type != 0 AND pd_visibilite = "public" '.
'ORDER BY pd_date_de_mise_a_jour DESC '.
'LIMIT 0,5';
$resume = array();
 
$titre = htmlspecialchars('Derniers documents publics ');
$lien = 'http://www.tela-botanica.org/page:liste_projets';
 
$docs = $this->bdd->query($requete_docs_projets)->fetchAll();
$rss = '<?xml version="1.0" encoding="UTF-8"?>'.
'<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>'.$titre.'</title>
<link>'.$lien.'</link>
<atom:link href="" rel="self" type="application/rss+xml" />
<description>'.$titre.'</description>';
foreach($docs as $doc) {
$infos_projet = $this->obtenirInformationsProjet($doc['pd_ce_projet']);
$date_modification_timestamp = strtotime($doc['pd_date_de_mise_a_jour']);
$date_maj_doc = date(DATE_RSS, $date_modification_timestamp);
$nom_projet = 'Dans le projet '.$infos_projet[0]['p_titre'];
$id_doc = $doc['pd_id'];
$nom_doc = $doc['pd_nom'];
$description = preg_replace('/&(?!(a-z+|#0-9+|#x0-9a-f+);)/i', '&amp;', $nom_projet);
$description = preg_replace('/000null/i', '', $nom_projet);
$description = htmlspecialchars($description);
$lien_doc = 'http://www.tela-botanica.org/projets/'.$doc['pd_ce_projet'].'/telechargement/'.$doc['pd_id'];
$rss .='<item>
<guid>'.$id_doc.'</guid>
<title>'.$nom_doc.'</title>
<link>'.$lien_doc.'</link>
<description>'.$description.'</description>
<category>Document</category>
<pubDate>'.$date_maj_doc.'</pubDate>
</item>';
}
$rss .= '</channel>'.
'</rss>';
 
echo $rss;
}
}
?>
/trunk/fichier_attache.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier_attache.php,v 1.1 2006/04/19 13:51:57 alexandre_tb Exp $
// CVS : $Id: fichier_attache.php,v 1.2 2008-08-25 15:27:32 alexandre_tb Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/trunk/projet.php
1,280 → 1,284
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.php,v 1.15 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* Fichier d'appel pour papyrus
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.15 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
 
// Inclusion des styles selon papyrus
if (function_exists("GEN_stockerStyleExterne")) {
if (file_exists('client/projet/projet.css')) GEN_stockerStyleExterne('projet','client/projet/projet.css') ;
}
 
// Nettoyage de la variable logout de papyrus
$GLOBALS['url']->removeQueryString('logout');
 
// Nous indiquons à Papyrus de ne pas chercher de balises d'applettes dans le contenu généré par l'appli
$GLOBALS['_PAPYRUS_']['applette']['analyse'] = true;
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("PROJET_DEFAUT", 1) ;
define ("PROJET_VOIR", 2) ;
define ('PROJET_MENU_AFFICHER_CONTENU_CORPS', 1) ;
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
if (isset($_REQUEST[PROJET_VARIABLE_ID_PROJET])) {
function afficherContenuNavigation () {
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ID_PROJET, $_REQUEST[PROJET_VARIABLE_ID_PROJET]) ;
if (empty($_REQUEST[PROJET_VARIABLE_ACTION])) {
$_REQUEST[PROJET_VARIABLE_ACTION] = PROJET_ACTION_VOIR_RESUME ;
}
$res = '' ;
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
$res .= '<ul class="onglets">';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_RESUME);
$res .= '<li id="projet_resume" class="'.cma(PROJET_ACTION_VOIR_RESUME).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_SYNTHESE.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DESCRIPTION);
$res .= '<li id="projet_description" class="'.cma(PROJET_ACTION_VOIR_DESCRIPTION).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_DESCRIPTION.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_WIKINI);
$res .= '<li id="projet_wikini" class="'.cma(PROJET_ACTION_VOIR_WIKINI).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_WIKINI.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
$res .= '<li id="projet_documents" class="'.cma(PROJET_ACTION_VOIR_DOCUMENT).'"><a href="'.$GLOBALS['url']->getURL().'">Documents</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM) ;
$res .= '<li id="projet_forum" class="'.cma(PROJET_ACTION_VOIR_FORUM).'"><a href="'.$GLOBALS['url']->getURL().'">Forum</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$res .= '<li id="projet_participants" class="'.cma(PROJET_ACTION_VOIR_PARTICIPANT).'"><a href="'.$GLOBALS['url']->getURL().'">Participants</a></li>';
$res .= '</ul>';
//$GLOBALS['url']->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
$res = '' ;
}
return $res ;
}
}
 
function afficherContenuMenu()
{
$sortie = '';
// on fait de meme pour id_projet
$id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
// On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
$action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
// et pour id_repertoire
$id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
 
$controleur = new projetControleur($GLOBALS['projet_db'], $GLOBALS['projet_auth'], $GLOBALS['url']) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
if ($id_projet != '' && projet::projetExiste($GLOBALS['projet_db'], $id_projet)) {
$controleur->setIdProjet($id_projet) ;
}
if ($id_repertoire != "") {
$controleur->setIdRepertoire($id_repertoire) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
$controleur->setPrive() ;
}
// Dans le cas de la presentation par arbre, on met les menus
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)){
 
$sortie .= $controleur->menuGeneral() ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->seulement)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
// L'action "Mettre un fichier en ligne"
$controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
$res = "<ul><li><a href=\"".$controleur->_url->getURL()."\">".PROJET_METTRE_FICHIER."</a></li>\n" ;
 
// L'action creer un repertoire
$controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
$res .= "<li><a href=\"".$controleur->_url->getURL()."\">".PROJET_CREER_REP."</a></li>\n" ;
$res .= '</ul></li>' ;
$sortie .= $res ;
}
// Dans le cas d'un forum simple, on ne met pas les menus
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
return ;
}
return $sortie;
}
 
function afficherContenuCorps() {
 
// On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
$action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
// on fait de meme pour id_projet
$id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
 
$service = isset($_REQUEST[PROJET_VARIABLE_SERVICE]) ? $_REQUEST[PROJET_VARIABLE_SERVICE] : '';
// et pour id_repertoire
$id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
 
// et pour id_document
$id_document = isset($_REQUEST['id_document']) ? $_REQUEST['id_document'] : '';
 
// On construit le controleur en lui passant en parametre l'identifiant de connexion a la BD
// l'objet d'authentification et l'url de la page
$controleur = new projetControleur(&$GLOBALS['projet_db'], &$GLOBALS['projet_auth'], &$GLOBALS['url']) ;
$controleur->setAction ($action) ;
$controleur->setService($service);
// On indique au controleur sur quel projet on travaille
if ($id_projet != "") {
$controleur->setIdProjet($id_projet) ;
 
}
if ($id_repertoire != "") {
$controleur->setIdRepertoire($id_repertoire) ;
}
if ($id_document != "") {
$controleur->setIdDocument($id_document) ;
}
// recuperation des parametres de l'appli
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
$controleur->setPresentation($GLOBALS['_GEN_commun']['info_application']->presentation) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->projet_type)) {
$controleur->setType($GLOBALS['_GEN_commun']['info_application']->projet_type) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->exclure)) {
$a_exclure = explode (',', $GLOBALS['_GEN_commun']['info_application']->exclure) ;
foreach ($a_exclure as $valeur) $controleur->exclure($valeur) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement_forum) ;
// S'il n'y a pas d'action en mode forum, on affiche l'onglet Forum
if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_FORUM) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_DOCUMENT) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
}
// Si le parametre prive est passe, les inscriptions sont moderes
// TODO : permettre la demande d'inscription
if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
$controleur->setPrive() ;
}
$res = $controleur->run() ;
return $res ;
}
 
/** cma() calcule menu actif
*
*
* @return
*/
 
function cma ($var) {
$class = $_REQUEST[PROJET_VARIABLE_ACTION] == $var ? 'menu_actif' : 'menu_inactif' ;
return $class ;
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: projet.php,v $
* Revision 1.15 2007-06-25 12:15:06 alexandre_tb
* merge from narmer
*
* Revision 1.14 2007/04/19 15:34:35 neiluj
* preparration release (livraison) "Narmer" - v0.25
*
* Revision 1.13 2007/04/19 09:18:46 alexandre_tb
* ajout de la variable $service pour appeler les services (dans la cadre de liaisons asynchrones
*
* Revision 1.12 2006/07/04 09:35:04 alexandre_tb
* Simplification du code et ajout de controle
*
* Revision 1.11 2006/04/28 12:41:28 florian
* corrections erreurs chemin
*
* Revision 1.10 2005/12/01 16:38:32 alexandre_tb
* ajout de l'action telechargement
*
* Revision 1.9 2005/11/25 14:48:44 alexandre_tb
* ajout de la gestion de la pr�sentation tela
*
* Revision 1.8 2005/10/25 13:50:13 alexandre_tb
* Ajout de la gestion des projets priv�s
*
* Revision 1.7 2005/10/17 16:22:28 alexandre_tb
* rien
*
* Revision 1.6 2005/10/06 14:54:06 alexandre_tb
* ajout de la gestion du param�tre seulement_forum
*
* Revision 1.5 2005/10/04 10:06:32 alexandre_tb
* ajout du parametre seulement_forum
*
* Revision 1.4 2005/09/28 16:29:39 ddelon
* Merge modification projet
*
* Revision 1.3 2005/09/27 16:31:06 alexandre_tb
* ??
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.php,v 1.17 2008-10-22 08:21:58 aperonnet Exp $
/**
* Application projet
*
* Fichier d'appel pour papyrus
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.17 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
 
// Inclusion des styles selon papyrus
if (function_exists("GEN_stockerStyleExterne")) {
if (file_exists('client/projet/projet.css')) GEN_stockerStyleExterne('projet','client/projet/projet.css') ;
}
 
// Nettoyage de la variable logout de papyrus
$GLOBALS['url']->removeQueryString('logout');
 
// Nous indiquons à Papyrus de ne pas chercher de balises d'applettes dans le contenu généré par l'appli
$GLOBALS['_PAPYRUS_']['applette']['analyse'] = true;
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("PROJET_DEFAUT", 1) ;
define ("PROJET_VOIR", 2) ;
define ('PROJET_MENU_AFFICHER_CONTENU_CORPS', 1) ;
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
if (isset($_REQUEST[PROJET_VARIABLE_ID_PROJET])) {
function afficherContenuNavigation () {
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ID_PROJET, $_REQUEST[PROJET_VARIABLE_ID_PROJET]) ;
if (empty($_REQUEST[PROJET_VARIABLE_ACTION])) {
$_REQUEST[PROJET_VARIABLE_ACTION] = PROJET_ACTION_VOIR_RESUME ;
}
$res = '' ;
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
$res .= '<ul class="onglets">';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_RESUME);
$res .= '<li id="projet_resume" class="'.cma(PROJET_ACTION_VOIR_RESUME).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_SYNTHESE.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DESCRIPTION);
$res .= '<li id="projet_description" class="'.cma(PROJET_ACTION_VOIR_DESCRIPTION).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_DESCRIPTION.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_WIKINI);
$res .= '<li id="projet_wikini" class="'.cma(PROJET_ACTION_VOIR_WIKINI).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_WIKINI.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
$res .= '<li id="projet_documents" class="'.cma(PROJET_ACTION_VOIR_DOCUMENT).'"><a href="'.$GLOBALS['url']->getURL().'">Documents</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM) ;
$res .= '<li id="projet_forum" class="'.cma(PROJET_ACTION_VOIR_FORUM).'"><a href="'.$GLOBALS['url']->getURL().'">Forum</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$res .= '<li id="projet_participants" class="'.cma(PROJET_ACTION_VOIR_PARTICIPANT).'"><a href="'.$GLOBALS['url']->getURL().'">Participants</a></li>';
$res .= '</ul>';
//$GLOBALS['url']->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
$res = '' ;
}
return $res ;
}
}
 
function afficherContenuMenu()
{
$sortie = '';
// on fait de meme pour id_projet
$id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
// On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
$action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
// et pour id_repertoire
$id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
 
$controleur = new projetControleur($GLOBALS['projet_db'], $GLOBALS['projet_auth'], $GLOBALS['url']) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
if ($id_projet != '' && projet::projetExiste($GLOBALS['projet_db'], $id_projet)) {
$controleur->setIdProjet($id_projet) ;
}
if ($id_repertoire != "") {
$controleur->setIdRepertoire($id_repertoire) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
$controleur->setPrive() ;
}
// Dans le cas de la presentation par arbre, on met les menus
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation) || isset($controleur->_presentation)){
 
$sortie .= $controleur->menuGeneral() ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->seulement)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
// L'action "Mettre un fichier en ligne"
$controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
$res = "<ul><li><a href=\"".$controleur->_url->getURL()."\">".PROJET_METTRE_FICHIER."</a></li>\n" ;
 
// L'action creer un repertoire
$controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
$res .= "<li><a href=\"".$controleur->_url->getURL()."\">".PROJET_CREER_REP."</a></li>\n" ;
$res .= '</ul></li>' ;
$sortie .= $res ;
}
// Dans le cas d'un forum simple, on ne met pas les menus
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
return ;
}
return $sortie;
}
 
function afficherContenuCorps() {
 
// On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
$action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
// on fait de meme pour id_projet
$id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
 
$service = isset($_REQUEST[PROJET_VARIABLE_SERVICE]) ? $_REQUEST[PROJET_VARIABLE_SERVICE] : '';
// et pour id_repertoire
$id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
 
// et pour id_document
$id_document = isset($_REQUEST['id_document']) ? $_REQUEST['id_document'] : '';
 
// On construit le controleur en lui passant en parametre l'identifiant de connexion a la BD
// l'objet d'authentification et l'url de la page
$controleur = new projetControleur(&$GLOBALS['projet_db'], &$GLOBALS['projet_auth'], &$GLOBALS['url']) ;
$controleur->setAction ($action) ;
$controleur->setService($service);
// On indique au controleur sur quel projet on travaille
if ($id_projet != "") {
$controleur->setIdProjet($id_projet) ;
 
}
if ($id_repertoire != "") {
$controleur->setIdRepertoire($id_repertoire) ;
}
if ($id_document != "") {
$controleur->setIdDocument($id_document) ;
}
// recuperation des parametres de l'appli
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
$controleur->setPresentation($GLOBALS['_GEN_commun']['info_application']->presentation) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->projet_type)) {
$controleur->setType($GLOBALS['_GEN_commun']['info_application']->projet_type) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->exclure)) {
$a_exclure = explode (',', $GLOBALS['_GEN_commun']['info_application']->exclure) ;
foreach ($a_exclure as $valeur) $controleur->exclure($valeur) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement_forum) ;
// S'il n'y a pas d'action en mode forum, on affiche l'onglet Forum
if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_FORUM) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_DOCUMENT) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
}
// Si le parametre prive est passe, les inscriptions sont moderes
// TODO : permettre la demande d'inscription
if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
$controleur->setPrive() ;
}
$res = $controleur->run() ;
 
return $res ;
}
 
/** cma() calcule menu actif
*
*
* @return
*/
 
function cma ($var) {
$class = $_REQUEST[PROJET_VARIABLE_ACTION] == $var ? 'menu_actif' : 'menu_inactif' ;
return $class ;
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.16 2008-08-25 15:26:18 alexandre_tb
* encodage
*
* Revision 1.15 2007-06-25 12:15:06 alexandre_tb
* merge from narmer
*
* Revision 1.14 2007/04/19 15:34:35 neiluj
* preparration release (livraison) "Narmer" - v0.25
*
* Revision 1.13 2007/04/19 09:18:46 alexandre_tb
* ajout de la variable $service pour appeler les services (dans la cadre de liaisons asynchrones
*
* Revision 1.12 2006/07/04 09:35:04 alexandre_tb
* Simplification du code et ajout de controle
*
* Revision 1.11 2006/04/28 12:41:28 florian
* corrections erreurs chemin
*
* Revision 1.10 2005/12/01 16:38:32 alexandre_tb
* ajout de l'action telechargement
*
* Revision 1.9 2005/11/25 14:48:44 alexandre_tb
* ajout de la gestion de la présentation tela
*
* Revision 1.8 2005/10/25 13:50:13 alexandre_tb
* Ajout de la gestion des projets privés
*
* Revision 1.7 2005/10/17 16:22:28 alexandre_tb
* rien
*
* Revision 1.6 2005/10/06 14:54:06 alexandre_tb
* ajout de la gestion du paramètre seulement_forum
*
* Revision 1.5 2005/10/04 10:06:32 alexandre_tb
* ajout du parametre seulement_forum
*
* Revision 1.4 2005/09/28 16:29:39 ddelon
* Merge modification projet
*
* Revision 1.3 2005/09/27 16:31:06 alexandre_tb
* ??
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/trunk/wikini/bibliotheque/images/aide/ecran_general.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/aide/choix_modalites.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/aide/choix_descripteur.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/aide/choix_taxon.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/projet-stage.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/telabotanica/logo_tb_pr_wikini.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/icones/vide.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/icones/fichier.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/images/icones/repertoire.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/bibliotheque/documents/matrice_dipsacales.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/wakka.print.css
60,8 → 60,8
/* - les images */
.attach_margin05em { margin: 0.5em;} /* marge de 0.5 em autour de l'image*/
.attach_margin1em { margin: 1em;} /* marge de 1em autour de l'image*/
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_noborder {border-width: 0px;} /* pas de bordure */
.attach_vmiddle {vertical-align: text-bottom;} /* aligenement vertical au milieu */
 
/trunk/wikini/ACEdImages/listepuce.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/ACEdImages/code.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/ACEdImages/crlf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/ACEdImages/php.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/wakka.php
772,7 → 772,7
 
 
// compare versions, start installer if necessary
if ($wakkaConfig["wakka_version"] && (!$wakkaConfig["wikini_version"])) { $wakkaConfig["wikini_version"]=$wakkaConfig["wakka_version"]; }
if ($wakkaConfig["wakka_version"] && (!$wakkaConfig["wikini_version"])) { $wakkaConfig["wikini_version"]=$wakkaConfig["wakka_version"]; }
if (($wakkaConfig["wakka_version"] != WAKKA_VERSION) || ($wakkaConfig["wikini_version"] != WIKINI_VERSION)) {
// start installer
if (!isset($_REQUEST["installAction"]) OR !$installAction = trim($_REQUEST["installAction"])) $installAction = "default";
/trunk/wikini/wakka.css
90,8 → 90,8
/* - les images */
.attach_margin05em { margin: 0.5em;} /* marge de 0.5 em autour de l'image*/
.attach_margin1em { margin: 1em;} /* marge de 1em autour de l'image*/
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_noborder {border-width: 0px;} /* pas de bordure */
.attach_vmiddle {vertical-align: text-bottom;} /* aligenement vertical au milieu */
/* - le gestionnaire des uploads */
/trunk/wikini/formatters/hightlighter.class.inc
1,6 → 1,6
<?php
/*
* $Id: hightlighter.class.inc,v 1.1 2005/09/22 14:02:49 ddelon Exp $
* $Id: hightlighter.class.inc,v 1.1 2005-09-22 14:02:49 ddelon Exp $
*
* Souligneur générique pour colorier la syntaxe de langage de programmation
*
/trunk/wikini/formatters/coloration_delphi.php
1,6 → 1,6
<?php
/*
* $Id: coloration_delphi.php,v 1.1 2005/09/22 14:02:49 ddelon Exp $
* $Id: coloration_delphi.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
*
* Souligneur syntaxique Delphi
*
/trunk/wikini/wakka.config.php
11,7 → 11,7
"mysql_host" => "localhost",
"mysql_database" => "tela_prod_wikini",
"mysql_user" => "telabotap",
"mysql_password" => "shah=Ph3",
"mysql_password" => "ppo50cvb",
"table_prefix" => strtolower($nom_wiki)."_",
"root_page" => "PagePrincipale",
"wakka_name" => $nom_wiki,
/trunk/wikini/files/Knautia_sylvatica.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/files/Centranthus_ruber.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/files/dipsacusfullonum.doc
File deleted
\ No newline at end of file
/trunk/wikini/files/Sambucus_nigra.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/files/Scabiosa_columbaria.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/files/Liste_des_dipsacales.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/files/Caracteres_Dipsacales.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/wikini/wakka.basic.css
43,8 → 43,8
/* - les images */
.attach_margin05em { margin: 0.5em;} /* marge de 0.5 em autour de l'image*/
.attach_margin1em { margin: 1em;} /* marge de 1em autour de l'image*/
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_noborder {border-width: 0px;} /* pas de bordure */
.attach_vmiddle {vertical-align: text-bottom;} /* aligenement vertical au milieu */
/* - le gestionnaire des uploads */
/trunk/projet.css
1,440 → 1,440
/*
+----------------------------------------------------------------------------+
| projets.css |
+----------------------------------------------------------------------------+
| Copyright (c) 2008 Tela Botanica |
+----------------------------------------------------------------------------+
| Feuille de style specifique a l'application projet de Tela Botanica |
+----------------------------------------------------------------------------+
| Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
+----------------------------------------------------------------------------+
*/
 
.table_cadre {
line-height : 18px;
}
 
.information_projet {
float:right;
width:250px;
text-align:left;
max-width: 800px;
position : relative;
left : -3px;
}
 
 
.information_projet ul {
margin-top : 10px;
}
 
.information_projet li {
margin-left: 20px;
}
 
#texte {
max-width:850px;
}
.liste_projet li {
padding:8px;
list-style-type:none;
 
}
 
.liste_projet h3 {
margin: 10px 0 0;
}
#precedent, #suivant {
border:1px solid black;
padding: 3px 4px 3px 4px;
margin: 3px;
background-image: none;
}
 
#precedent a, #suivant a {
text-decoration:none;
background-image:none;
}
#precedent:before {content: "<< ";}
#suivant:after {content: " >>";}
.nombre_message {
font-size:14px;
color: #ad5a40;
}
 
#precedent:hover, #suivant:hover {background-color:#eddbd6;}
#bouton_repondre {float:none;display:inline;}
.mois {background-color:#DFDFDF;padding:3px;
text-align:center;}
#petit_calendrier table {border:1px solid black;}
#petit_calendrier th {background-color:#C2C0AD;color:white;padding:2px;}
.col_annee {font-weight:bold;}
.liste_projet li:hover {
background-color:#F5F5F5;
}
.liste_projet a, .liste_projet h1 {
background-color:transparent;
}
 
.liste_projet li {
list-style-image: none !important;
}
 
ul.liste_projet {max-width:700px;margin-left:0px;padding-left:0px;}
.liste_projet h1{font-size:15px;padding-top:0px;margin-top:0px}
.projet_activite_elevee {color:red;}
.projet_activite_moyenne {color:green;}
.projet_activite_faible {color:blue;}
 
#projet_theme {
margin-left: 20px;
}
 
#projet_theme h1{
background:none;
color:black;
}
.pager {
width:100%;max-width:600px;
text-align:center;
margin:10px 0 10px 0;
}
 
.pager .page_courante, .pager a {
border:1px solid black;
padding:3px 4px 3px 4px;
margin:3px;
background-image:none;
}
.pager .page_courante {
background-color:#eddbd6;
background-image:none;
}
.pager a:hover {
background-color:#eddbd6;
background-image:none;
}
 
.projet_recherche {
margin-bottom:5px;
}
.projet_recherche fieldset {border:0px;}
.notes input {
border:1px solid #ad5a40;
background-color:#eddbd6;
}
#projet_recherche_submit {
text-align:center;
margin:5px;
}
 
#projet_range {display:inline;}
#projet_choix_mode {display:inline;width:100%;text-align:right;}
#projet_range .nombre {font-weight:bold;}
#cartouche_liste_projet {width:100;margin-left:40px;padding:8px;}
 
table.table_cadre {display:block;max-width:800px;}
.table_cadre a.tri_bas {
background: url("/client/projet/images/icon_sort_dwn.gif") no-repeat left;
padding: 0 0 0 10px;
color:white;
}
.table_cadre a.tri_haut {
background: url("/client/projet/images/icon_sort_up.gif") no-repeat left;
padding: 0 0 0 10px;
color:white;
}
.table_cadre a.tri_sans {
background: url("/client/projet/images/icon_sort.gif") no-repeat left;
padding: 0 0 0 10px;
color:white;
}
 
#table_projet {max-width:100%;width:100%}
 
#projet_bloc_action {
border:0px solid black;
margin:0 0 10px 0px;
width:100%;
max-width:680px;
}
#projet_bloc_action img {
float:left;
}
 
#projet_bloc_action h2 {
clear:none;
}
#projet_lien_inscription {
height:45px;
width:280px;
padding:0 5px 0 0;margin:0;
border:1px solid black;
text-decoration:none;
display:block;
float:left;
background-color:#ede7d8;
overflow:hidden;
}
#projet_lien_inscription a {
padding:0;
width:100%;
display:block;
float:left;
text-decoration:none;
color:black;
background-image:none;
}
 
 
#projet_ou {
text-align:center;
float:left;
width:80px;
font:bold 17px arial;
color:#ad5a40;
margin:20px 50px 10px 50px;
}
 
 
#projet_lien_inscription:hover, #projet_lien_login:hover {background-color:darkgrey;}
 
#projet_lien_login {
background-color:#ede7d8;
width:220px;
height:45px;
margin:0;
overflow:hidden;
border:1px solid black;
float:right;
}
 
#projet_lien_login a {
cursor:pointer;
padding:0;
width:250px;
display:block;
text-decoration:none;
background-image: none;
float:left;
}
#projet_bloc_inscription {
width:265px;
margin-top:10px;
background-color:#ede7d8;
border:1px solid black;
padding:10px;
}
#projet_bloc_inscription span, #projet_lien_inscription span {
margin:12px 0 0 10px;
font:bold 15px Arial, sans-serif;
display:block;
float:left;
color:black;
}
 
#projet_bloc_inscription p {
margin:0;
font:normal 13px/15px Arial;
}
 
#projet_bloc_inscription form {
margin:25px 0 0 0;
font-weight:bold;
}
#projet_bloc_inscription label {
font-weight:normal;
}
#projet_bloc_inscription input {
display:block;
margin-bottom:6px;
width:85%;
}
#projet_bloc_inscription input[type="submit"] {
width:35px;margin:auto;
text-align:center;
}
#projet_bloc_inscription input[type="checkbox"] {
width:15px;
float:left;
}
 
#projet_bloc_inscription:hover {
}
 
 
#laius_inscription {
color:#005500;
font-weight:bold;
line-height:5px;
}
 
#form_connexion2 fieldset {border:0;margin:0;padding:0;}
#form_connexion2 legend {display:none;}
#persistant2 {width:10px;}
/** Les petits bouton */
.projet_bouton_action {
}
.projet_bouton_action:hover {
background-color:#c38673;
}
.projet_bouton_action a {
display:block;
float:left;
margin:0 7px 0 0;
background-color:#f5f5f5;
border:1px solid #dedede;
border-top:1px solid #eee;
border-left:1px solid #eee;
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:100%;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
padding:5px 10px 6px 7px; /* Links */
background-image:none;
margin-bottom:10px;
}
 
 
.projet_bouton_inline {display:inline;}
 
.projet_bouton_inline a {
display:inline;
 
margin:0 7px 0 0;
background-color:#f5f5f5;
border:1px solid #dedede;
border-top:1px solid #eee;
border-left:1px solid #eee;
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:100%;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
padding:5px 10px 6px 7px; /* Links */
background-image:none;
 
}
#lien_inscription2 {display:none !important;}
 
.projet_bouton_action a img, .projet_bouton_inline a img {
margin:0 3px -3px 0 !important;
padding:0;
border:none;
width:16px;
height:16px;
}
.projet_bouton_action a:hover, .projet_bouton_inline a:hover{
background-color:#dff4ff;
border:1px solid #c2e1ef;
color:#336699;
}
 
.projet_bouton_action a:active{
background-color:#6299c5;
border:1px solid #6299c5;
color:#fff;
}
 
/** Menus de projets **/
.menu_projet li {
background: none;
margin-left:15px;
}
 
.menu_projet > li {
list-style-image: none !important;
}
 
/* Onglets */
 
.onglets {
}
 
.onglets li {
list-style-image : none;
}
 
.onglets li:hover {
color:#AD5A40
}
 
.onglets li:hover a {
color:#AD5A40;
}
.onglets .menu_inactif {
border-bottom:#62210F;
}
.onglets .menu_actif {
background-color: #C2C0AD;
}
 
.onglets .menu_actif a {
color:#C2C0AD;
}
 
/*Tableau*/
 
.table_cadre {
border: 1px solid #C2C0AD;
}
 
.table_cadre th{
background-color:#A89D80;
padding:0 5px;
color:white;}
.table_cadre a {
color:black !important;}
.table_cadre tr {
height: 30px;
}
 
.table_cadre td {
padding-left:5px;
padding-right:5px;
}
.ligne_paire {
padding-top: 2px;
background-color:#C2C0AD;
}
 
.page li {
list-style-image: none !important;
margin-left: 30px;
}
 
/** Wikini **/
 
#wikini_page {
border-color: #A89D80;
}
 
#toolbar, .buttons {
background: #A89D80 !important;
}
 
.edit {
border-color: #A89D80 !important;
}
 
/** Message **/
.message pre {
white-space: pre-wrap;
}
 
/*
+----------------------------------------------------------------------------+
| projets.css |
+----------------------------------------------------------------------------+
| Copyright (c) 2008 Tela Botanica |
+----------------------------------------------------------------------------+
| Feuille de style specifique a l'application projet de Tela Botanica |
+----------------------------------------------------------------------------+
| Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
+----------------------------------------------------------------------------+
*/
 
.table_cadre {
line-height : 18px;
}
 
.information_projet {
float:right;
width:250px;
text-align:left;
max-width: 800px;
position : relative;
left : -3px;
}
 
 
.information_projet ul {
margin-top : 10px;
}
 
.information_projet li {
margin-left: 20px;
}
 
#texte {
max-width:850px;
}
.liste_projet li {
padding:8px;
list-style-type:none;
 
}
 
.liste_projet h3 {
margin: 10px 0 0;
}
#precedent, #suivant {
border:1px solid black;
padding: 3px 4px 3px 4px;
margin: 3px;
background-image: none;
}
 
#precedent a, #suivant a {
text-decoration:none;
background-image:none;
}
#precedent:before {content: "<< ";}
#suivant:after {content: " >>";}
.nombre_message {
font-size:14px;
color: #ad5a40;
}
 
#precedent:hover, #suivant:hover {background-color:#eddbd6;}
#bouton_repondre {float:none;display:inline;}
.mois {background-color:#DFDFDF;padding:3px;
text-align:center;}
#petit_calendrier table {border:1px solid black;}
#petit_calendrier th {background-color:#C2C0AD;color:white;padding:2px;}
.col_annee {font-weight:bold;}
.liste_projet li:hover {
background-color:#F5F5F5;
}
.liste_projet a, .liste_projet h1 {
background-color:transparent;
}
 
.liste_projet li {
list-style-image: none !important;
}
 
ul.liste_projet {max-width:700px;margin-left:0px;padding-left:0px;}
.liste_projet h1{font-size:15px;padding-top:0px;margin-top:0px}
.projet_activite_elevee {color:red;}
.projet_activite_moyenne {color:green;}
.projet_activite_faible {color:blue;}
 
#projet_theme {
margin-left: 20px;
}
 
#projet_theme h1{
background:none;
color:black;
}
.pager {
width:100%;max-width:600px;
text-align:center;
margin:10px 0 10px 0;
}
 
.pager .page_courante, .pager a {
border:1px solid black;
padding:3px 4px 3px 4px;
margin:3px;
background-image:none;
}
.pager .page_courante {
background-color:#eddbd6;
background-image:none;
}
.pager a:hover {
background-color:#eddbd6;
background-image:none;
}
 
.projet_recherche {
margin-bottom:5px;
}
.projet_recherche fieldset {border:0px;}
.notes input {
border:1px solid #ad5a40;
background-color:#eddbd6;
}
#projet_recherche_submit {
text-align:center;
margin:5px;
}
 
#projet_range {display:inline;}
#projet_choix_mode {display:inline;width:100%;text-align:right;}
#projet_range .nombre {font-weight:bold;}
#cartouche_liste_projet {width:100;margin-left:40px;padding:8px;}
 
table.table_cadre {display:block;max-width:800px;}
.table_cadre a.tri_bas {
background: url("/client/projet/images/icon_sort_dwn.gif") no-repeat left;
padding: 0 0 0 10px;
color:white;
}
.table_cadre a.tri_haut {
background: url("/client/projet/images/icon_sort_up.gif") no-repeat left;
padding: 0 0 0 10px;
color:white;
}
.table_cadre a.tri_sans {
background: url("/client/projet/images/icon_sort.gif") no-repeat left;
padding: 0 0 0 10px;
color:white;
}
 
#table_projet {max-width:100%;width:100%}
 
#projet_bloc_action {
border:0px solid black;
margin:0 0 10px 0px;
width:100%;
max-width:680px;
}
#projet_bloc_action img {
float:left;
}
 
#projet_bloc_action h2 {
clear:none;
}
#projet_lien_inscription {
height:45px;
width:280px;
padding:0 5px 0 0;margin:0;
border:1px solid black;
text-decoration:none;
display:block;
float:left;
background-color:#ede7d8;
overflow:hidden;
}
#projet_lien_inscription a {
padding:0;
width:100%;
display:block;
float:left;
text-decoration:none;
color:black;
background-image:none;
}
 
 
#projet_ou {
text-align:center;
float:left;
width:80px;
font:bold 17px arial;
color:#ad5a40;
margin:20px 50px 10px 50px;
}
 
 
#projet_lien_inscription:hover, #projet_lien_login:hover {background-color:darkgrey;}
 
#projet_lien_login {
background-color:#ede7d8;
width:220px;
height:45px;
margin:0;
overflow:hidden;
border:1px solid black;
float:right;
}
 
#projet_lien_login a {
cursor:pointer;
padding:0;
width:250px;
display:block;
text-decoration:none;
background-image: none;
float:left;
}
#projet_bloc_inscription {
width:265px;
margin-top:10px;
background-color:#ede7d8;
border:1px solid black;
padding:10px;
}
#projet_bloc_inscription span, #projet_lien_inscription span {
margin:12px 0 0 10px;
font:bold 15px Arial, sans-serif;
display:block;
float:left;
color:black;
}
 
#projet_bloc_inscription p {
margin:0;
font:normal 13px/15px Arial;
}
 
#projet_bloc_inscription form {
margin:25px 0 0 0;
font-weight:bold;
}
#projet_bloc_inscription label {
font-weight:normal;
}
#projet_bloc_inscription input {
display:block;
margin-bottom:6px;
width:85%;
}
#projet_bloc_inscription input[type="submit"] {
width:35px;margin:auto;
text-align:center;
}
#projet_bloc_inscription input[type="checkbox"] {
width:15px;
float:left;
}
 
#projet_bloc_inscription:hover {
}
 
 
#laius_inscription {
color:#005500;
font-weight:bold;
line-height:5px;
}
 
#form_connexion2 fieldset {border:0;margin:0;padding:0;}
#form_connexion2 legend {display:none;}
#persistant2 {width:10px;}
/** Les petits bouton */
.projet_bouton_action {
}
.projet_bouton_action:hover {
background-color:#c38673;
}
.projet_bouton_action a {
display:block;
float:left;
margin:0 7px 0 0;
background-color:#f5f5f5;
border:1px solid #dedede;
border-top:1px solid #eee;
border-left:1px solid #eee;
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:100%;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
padding:5px 10px 6px 7px; /* Links */
background-image:none;
margin-bottom:10px;
}
 
 
.projet_bouton_inline {display:inline;}
 
.projet_bouton_inline a {
display:inline;
 
margin:0 7px 0 0;
background-color:#f5f5f5;
border:1px solid #dedede;
border-top:1px solid #eee;
border-left:1px solid #eee;
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:100%;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
padding:5px 10px 6px 7px; /* Links */
background-image:none;
 
}
#lien_inscription2 {display:none !important;}
 
.projet_bouton_action a img, .projet_bouton_inline a img {
margin:0 3px -3px 0 !important;
padding:0;
border:none;
width:16px;
height:16px;
}
.projet_bouton_action a:hover, .projet_bouton_inline a:hover{
background-color:#dff4ff;
border:1px solid #c2e1ef;
color:#336699;
}
 
.projet_bouton_action a:active{
background-color:#6299c5;
border:1px solid #6299c5;
color:#fff;
}
 
/** Menus de projets **/
.menu_projet li {
background: none;
margin-left:15px;
}
 
.menu_projet > li {
list-style-image: none !important;
}
 
/* Onglets */
 
.onglets {
}
 
.onglets li {
list-style-image : none;
}
 
.onglets li:hover {
color:#AD5A40
}
 
.onglets li:hover a {
color:#AD5A40;
}
.onglets .menu_inactif {
border-bottom:#62210F;
}
.onglets .menu_actif {
background-color: #C2C0AD;
}
 
.onglets .menu_actif a {
color:#C2C0AD;
}
 
/*Tableau*/
 
.table_cadre {
border: 1px solid #C2C0AD;
}
 
.table_cadre th{
background-color:#A89D80;
padding:0 5px;
color:white;}
.table_cadre a {
color:black !important;}
.table_cadre tr {
height: 30px;
}
 
.table_cadre td {
padding-left:5px;
padding-right:5px;
}
.ligne_paire {
padding-top: 2px;
background-color:#C2C0AD;
}
 
.page li {
list-style-image: none !important;
margin-left: 30px;
}
 
/** Wikini **/
 
#wikini_page {
border-color: #A89D80;
}
 
#toolbar, .buttons {
background: #A89D80 !important;
}
 
.edit {
border-color: #A89D80 !important;
}
 
/** Message **/
.message pre {
white-space: pre-wrap;
}
 
/trunk/projet.desinscription.inc.php
1,86 → 1,86
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.desinscription.inc.php,v 1.3 2007-06-01 13:57:11 alexandre_tb Exp $
/**
* Inscription
*
* Le fichier de desinscription de projet, appele par l'inscription
* en cas de desinscription d'un utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// On recupere id_utilisateur, l'identifiant de la personne qui se desinscrit
// On se trouve dans la fonction afficherContenuCorps de inscription.php
 
 
 
include_once 'client/projet/configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
$participant = new participe($GLOBALS['ins_db']) ;
 
 
$tableau_projet = projet::getTousLesProjets($GLOBALS['ins_db']) ;
 
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($GLOBALS['ins_db'], array('identifiant' => INS_CHAMPS_ID, 'mail' => INS_CHAMPS_MAIL, 'table' => INS_ANNUAIRE, 'nom' => INS_CHAMPS_NOM,
'prenom' => INS_CHAMPS_PRENOM)) ;
$annuaire->setId($id_utilisateur) ;
// On boucle sur chaque projet et on desinscrit l'utilisateur
foreach ($tableau_projet as $projet) {
// On verifie si l utilisateur est le dernier coordinateur
// auquel cas on previent les administrateurs
if ($participant->isCoordinateur($id_utilisateur, $projet->getId(), $GLOBALS['ins_db'])) {
$controleur = new projetControleur($GLOBALS['ins_db'], $GLOBALS['AUTH'], $GLOBALS['ins_url']);
$controleur->setIdProjet($projet->getId());
$coord = $participant->getCoordinateurs($projet->getId());
if (count($coord) == 0) {
$controleur->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $annuaire);
}
}
// Le statut 4 desinscrit l'utilisateur, dans la methode setStatut
$participant->setStatut(4, $id_utilisateur, $projet->getId()) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($GLOBALS['ins_db']) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
 
 
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.desinscription.inc.php,v 1.4 2008-09-16 14:10:06 alexandre_tb Exp $
/**
* Inscription
*
* Le fichier de desinscription de projet, appele par l'inscription
* en cas de desinscription d'un utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// On recupere id_utilisateur, l'identifiant de la personne qui se desinscrit
// On se trouve dans la fonction afficherContenuCorps de inscription.php
 
 
 
include_once 'client/projet/configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
$participant = new participe($GLOBALS['ins_db']) ;
 
 
$tableau_projet = projet::getTousLesProjets($GLOBALS['ins_db']) ;
 
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($GLOBALS['ins_db'], array('identifiant' => INS_CHAMPS_ID, 'mail' => INS_CHAMPS_MAIL, 'table' => INS_ANNUAIRE, 'nom' => INS_CHAMPS_NOM,
'prenom' => INS_CHAMPS_PRENOM)) ;
$annuaire->setId($id_utilisateur) ;
 
// On boucle sur chaque projet et on desinscrit l'utilisateur
foreach ($tableau_projet as $projet) {
// On verifie si l utilisateur est le dernier coordinateur
// auquel cas on previent les administrateurs
if ($participant->isCoordinateur($id_utilisateur, $projet->getId(), $GLOBALS['ins_db'])) {
$controleur = new projetControleur($GLOBALS['ins_db'], $GLOBALS['AUTH'], $GLOBALS['ins_url']);
$controleur->setIdProjet($projet->getId());
$coord = $participant->getCoordinateurs($projet->getId());
if (count($coord) == 0) {
$controleur->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $annuaire);
}
}
 
// Le statut 4 desinscrit l'utilisateur, dans la methode setStatut
$participant->setStatut(4, $id_utilisateur, $projet->getId()) ;
$projet->getListesAssociees() ;
 
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($GLOBALS['ins_db']) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
 
}
}
 
 
?>
/trunk/classes/ezmlmAccessObject.class.php
1,355 → 1,354
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant � g�rer du contenu et des
// applications web.
// Ce logiciel est regi par la licence CeCILL soumise au droit francais et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusee par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilite au code source et des droits de copie,
// de modification et de redistribution accordes par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitee. Pour les memes raisons,
// seule une responsabilite restreinte pese sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concedants successifs.
 
// A cet egard l'attention de l'utilisateur est attiree sur les risques
// associes au chargement, a l'utilisation, a la modification et/ou au
// developpement et a la reproduction du logiciel par l'utilisateur etant
// donne sa specificite de logiciel libre, qui peut le rendre complexe a
// manipuler et qui le reserve donc a des developpeurs et des professionnels
// avertis possedant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invites a charger et tester l'adequation du
// logiciel a leurs besoins dans des conditions permettant d'assurer la
// securite de leurs systemes et ou de leurs donnees et, plus generalement,
// a l'utiliser et l'exploiter dans les memes conditions de securite.
 
// Le fait que vous puissiez acceder a cet en-tete signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepte les
// termes.
// ----
// CVS : $Id: ezmlmAccessObject.class.php,v 1.5 2007-06-25 12:15:06 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe ezmlmAccessObject
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/** Etend XML_Parser_Simple */
require_once 'XML/Parser/Simple.php' ;
 
/**
* Les codes erreurs
*/
define ('EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE', 206) ;
/**
* classe ezmlmAccessObject parse les fichiers XML
* issue de ezmlm
*
* @category XML
* @package projet
* @author alex
*/
class ezmlmAccessObject extends XML_Parser_Simple {
/**
* Le domaine de la liste
*/
var $domaine ;
/**
* Le nom de la liste
*/
var $liste ;
/**
* Les actions valides
*/
var $actions_supportees = array ('calendrier_messages',
'message',
'derniers_messages',
'messages_auteur',
'messages_mois',
'messages_thread',
'supprimer',
'liste_abonnes',
'nombre_messages');
/**
* l'action selectionnee
*/
var $action ;
/**
* La langue 'fr-FR'
*/
var $langue ;
/**
* L'url de base
*/
var $url ;
/**
* L'identifiant du repertoire
*/
var $identifiant_repertoire ;
/**
* Identifiant message
*/
var $identifiant_message;
 
/**
* L'identifiant du repertoire
*/
var $_numeroRepertoireSuivant ;
/**
* L'identifiant du repertoire
*/
var $hash_auteur ;
/**
* Le mois a afficher
*/
var $mois ;
var $_numeraRepertoirePrecedent;
/**
* Identifiant message
*/
var $_numeroFichierSuivant;
var $_numeroFichierPrecedent;
var $chemin_fichier_xml;
/**
* Creation de l'objet d'acces
*
*/
function ezmlmAccessObject ($action, $domaine, $liste, $langue = 'fr', $url = '') {
$this->XML_Parser_Simple(null, 'func') ;
$this->action = $action ;
$this->domaine = $domaine ;
$this->liste = $liste ;
$this->langue = $langue ;
$this->url = $url ;
}
/**
* Gestion des balises
*
* Cette methode specifie les balises reconnus par ezmlmAccessObject
* Elle remplace la methode handleElement de XML_Parser_Simple
*
* @access public
* @param string nom de l'element (Voir la doc de PHP)
* @param array attributes
* @param
* @link http://fr.php.net/manual/fr/ref.xml.php manuel
*/
function handleElement_ezmlm_message ($name, $attribs, $data) {
echo $data ;
}
function handleElement_message_suivant ($name, $attribs, $data) {
$this->_numeroRepertoireSuivant = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierSuivant = $attribs['NUMERO'] ;
}
function handleElement_message_precedent ($name, $attribs, $data) {
$this->_numeroRepertoirePrecedent = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierPrecedent = $attribs['NUMERO'] ;
}
function handleElement_ezmlm_calendrier_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_derniers_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_auteur ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_mois ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_thread ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_liste_abonnes ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_nombre_messages ($name, $attribs, $data) { echo $data ; }
/**
* Choix de l'action
*
* Liste des actions :
* 'calendrier_messages'
*
* @access public
* @param string une action qui doit etre support�
*/
function setAction($action) {
// verification de l'action
if (!in_array($action, $this->actions_supportees)) {
return raiseError(EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE) ;
}
$this->action = $action ;
// Libere les ressources (XML_Parser::free)
$this->free();
// On vide l url
//$this->url = '';
$this->chemin_fichier_xml = '';
// Charge la nouvelle action
$this->load() ;
}
/**
* Charge une action
*
* cad affecte un fichier xml au parser
*
* @access public
*/
function load() {
$this->chemin_fichier_xml = PROJET_SERVEUR_VPOPMAIL.'/'.$this->action.'.php?domaine='.
$this->domaine.'&liste='.$this->liste.'&langue='.
$this->langue ;
if ($this->url != '') $this->chemin_fichier_xml.= '&url='.urlencode($this->url) ;
if (isset ($this->identifiant_repertoire))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_repertoire ;
if (isset ($this->identifiant_message))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_message ;
if (isset ($this->hash_auteur))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->hash_auteur ;
if (isset ($this->mois))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->mois ;
$this->setInputFile($this->chemin_fichier_xml) ;
}
/**
* Precise un message a extraire
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param integer le numero du repertoire
* @param integer le numero du message
*
*/
function setIdMessage ($identifiant_repertoire, $identifiant_message) {
$this->identifiant_repertoire = $identifiant_repertoire ;
$this->identifiant_message = $identifiant_message ;
}
/**
* Precise un auteur
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param string le hash d'un auteur
*
*/
function setHashAuteur ($hash_auteur) {
$this->hash_auteur = $hash_auteur;
}
/**
* Precise un mois
*
* On indique le numero de repertoire ezmlm et le num�ro du message
* @param string le hash d'un auteur
*
*/
function setMois ($mois) {
$this->mois = $mois;
}
/**
* Renvoi le numero du repertoire suivant
*
*
*/
function getNumeroRepertoireSuivant() { return $this->_numeroRepertoireSuivant; }
function getNumeroFichierSuivant () { return $this->_numeroFichierSuivant ; }
function getNumeroRepertoirePrecedent() { return $this->_numeroRepertoirePrecedent; }
function getNumeroFichierPrecedent () { return $this->_numeroFichierPrecedent ; }
function getNumeroMessage () { return $this->_numeroMessage ; }
function getNombreTotalMessage () { return $this->_nombreTotalMessage ; }
function parse()
{
if (substr(phpversion(), 0, 1) == '5') {
try {
$xml = new SimpleXMLElement($this->chemin_fichier_xml, null, true);
switch ($this->action) {
case 'calendrier_messages' :echo utf8_decode($xml);
trigger_error ($this->chemin_fichier_xml);
echo utf8_decode($xml->ezmlm_calendrier_messages);
break;
case 'message':
echo utf8_decode ($xml);
$this->_numeroRepertoirePrecedent = $xml->message_precedent['numero_repertoire'];
$this->_numeroRepertoireSuivant = $xml->message_suivant['numero_repertoire'];
$this->_numeroFichierSuivant = $xml->message_suivant['numero'];
$this->_numeroFichierPrecedent = $xml->message_precedent['numero'];
$this->_numeroMessage = $xml->numero;
$this->_nombreTotalMessage = $xml->numero['total_message'];
break;
case 'nombre_messages':
echo $xml[0];
break;
case 'liste_abonnes':
return $xml;
break;
default :
echo utf8_decode($xml);
}
$error = 'Erreur dans l\'acc&egrave;s au fichier:<br />'.$this->chemin_fichier_xml.'<br />';
$error = '';
throw new Exception($error);
}
catch (Exception $e) {
echo $e->getMessage().'<br />';
//echo $this->chemin_fichier_xml;
}
} else {
return parent::parse();
}
}
}
 
?>
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant � g�rer du contenu et des
// applications web.
// Ce logiciel est regi par la licence CeCILL soumise au droit francais et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusee par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilite au code source et des droits de copie,
// de modification et de redistribution accordes par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitee. Pour les memes raisons,
// seule une responsabilite restreinte pese sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concedants successifs.
 
// A cet egard l'attention de l'utilisateur est attiree sur les risques
// associes au chargement, a l'utilisation, a la modification et/ou au
// developpement et a la reproduction du logiciel par l'utilisateur etant
// donne sa specificite de logiciel libre, qui peut le rendre complexe a
// manipuler et qui le reserve donc a des developpeurs et des professionnels
// avertis possedant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invites a charger et tester l'adequation du
// logiciel a leurs besoins dans des conditions permettant d'assurer la
// securite de leurs systemes et ou de leurs donnees et, plus generalement,
// a l'utiliser et l'exploiter dans les memes conditions de securite.
 
// Le fait que vous puissiez acceder a cet en-tete signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepte les
// termes.
// ----
// CVS : $Id: ezmlmAccessObject.class.php,v 1.6 2008-08-25 15:16:59 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe ezmlmAccessObject
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/** Etend XML_Parser_Simple */
require_once 'XML/Parser/Simple.php' ;
 
/**
* Les codes erreurs
*/
define ('EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE', 206) ;
/**
* classe ezmlmAccessObject parse les fichiers XML
* issue de ezmlm
*
* @category XML
* @package projet
* @author alex
*/
class ezmlmAccessObject extends XML_Parser_Simple {
/**
* Le domaine de la liste
*/
var $domaine ;
/**
* Le nom de la liste
*/
var $liste ;
/**
* Les actions valides
*/
var $actions_supportees = array ('calendrier_messages',
'message',
'derniers_messages',
'messages_auteur',
'messages_mois',
'messages_thread',
'supprimer',
'liste_abonnes',
'nombre_messages');
/**
* l'action selectionnee
*/
var $action ;
/**
* La langue 'fr-FR'
*/
var $langue ;
/**
* L'url de base
*/
var $url ;
/**
* L'identifiant du repertoire
*/
var $identifiant_repertoire ;
/**
* Identifiant message
*/
var $identifiant_message;
 
/**
* L'identifiant du repertoire
*/
var $_numeroRepertoireSuivant ;
/**
* L'identifiant du repertoire
*/
var $hash_auteur ;
/**
* Le mois a afficher
*/
var $mois ;
var $_numeraRepertoirePrecedent;
/**
* Identifiant message
*/
var $_numeroFichierSuivant;
var $_numeroFichierPrecedent;
var $chemin_fichier_xml;
/**
* Creation de l'objet d'acces
*
*/
function ezmlmAccessObject ($action, $domaine, $liste, $langue = 'fr', $url = '') {
$this->XML_Parser_Simple(null, 'func') ;
$this->action = $action ;
$this->domaine = $domaine ;
$this->liste = $liste ;
$this->langue = $langue ;
$this->url = $url ;
}
/**
* Gestion des balises
*
* Cette methode specifie les balises reconnus par ezmlmAccessObject
* Elle remplace la methode handleElement de XML_Parser_Simple
*
* @access public
* @param string nom de l'element (Voir la doc de PHP)
* @param array attributes
* @param
* @link http://fr.php.net/manual/fr/ref.xml.php manuel
*/
function handleElement_ezmlm_message ($name, $attribs, $data) {
echo $data ;
}
function handleElement_message_suivant ($name, $attribs, $data) {
$this->_numeroRepertoireSuivant = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierSuivant = $attribs['NUMERO'] ;
}
function handleElement_message_precedent ($name, $attribs, $data) {
$this->_numeroRepertoirePrecedent = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierPrecedent = $attribs['NUMERO'] ;
}
function handleElement_ezmlm_calendrier_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_derniers_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_auteur ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_mois ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_thread ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_liste_abonnes ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_nombre_messages ($name, $attribs, $data) { echo $data ; }
/**
* Choix de l'action
*
* Liste des actions :
* 'calendrier_messages'
*
* @access public
* @param string une action qui doit etre support�
*/
function setAction($action) {
// verification de l'action
if (!in_array($action, $this->actions_supportees)) {
return raiseError(EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE) ;
}
$this->action = $action ;
// Libere les ressources (XML_Parser::free)
$this->free();
// On vide l url
//$this->url = '';
$this->chemin_fichier_xml = '';
// Charge la nouvelle action
$this->load() ;
}
/**
* Charge une action
*
* cad affecte un fichier xml au parser
*
* @access public
*/
function load() {
$this->chemin_fichier_xml = PROJET_SERVEUR_VPOPMAIL.'/'.$this->action.'.php?domaine='.
$this->domaine.'&liste='.$this->liste.'&langue='.
$this->langue ;
if ($this->url != '') $this->chemin_fichier_xml.= '&url='.urlencode($this->url) ;
if (isset ($this->identifiant_repertoire))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_repertoire ;
if (isset ($this->identifiant_message))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_message ;
if (isset ($this->hash_auteur))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->hash_auteur ;
if (isset ($this->mois))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->mois ;
$this->setInputFile($this->chemin_fichier_xml) ;
}
/**
* Precise un message a extraire
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param integer le numero du repertoire
* @param integer le numero du message
*
*/
function setIdMessage ($identifiant_repertoire, $identifiant_message) {
$this->identifiant_repertoire = $identifiant_repertoire ;
$this->identifiant_message = $identifiant_message ;
}
/**
* Precise un auteur
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param string le hash d'un auteur
*
*/
function setHashAuteur ($hash_auteur) {
$this->hash_auteur = $hash_auteur;
}
/**
* Precise un mois
*
* On indique le numero de repertoire ezmlm et le num�ro du message
* @param string le hash d'un auteur
*
*/
function setMois ($mois) {
$this->mois = $mois;
}
/**
* Renvoi le numero du repertoire suivant
*
*
*/
function getNumeroRepertoireSuivant() { return $this->_numeroRepertoireSuivant; }
function getNumeroFichierSuivant () { return $this->_numeroFichierSuivant ; }
function getNumeroRepertoirePrecedent() { return $this->_numeroRepertoirePrecedent; }
function getNumeroFichierPrecedent () { return $this->_numeroFichierPrecedent ; }
function getNumeroMessage () { return $this->_numeroMessage ; }
function getNombreTotalMessage () { return $this->_nombreTotalMessage ; }
function parse()
{
if (substr(phpversion(), 0, 1) == '5') {
try {
$xml = new SimpleXMLElement($this->chemin_fichier_xml, null, true);
switch ($this->action) {
case 'calendrier_messages' :echo $xml;
echo $xml->ezmlm_calendrier_messages;
break;
case 'message':
echo $xml;
$this->_numeroRepertoirePrecedent = $xml->message_precedent['numero_repertoire'];
$this->_numeroRepertoireSuivant = $xml->message_suivant['numero_repertoire'];
$this->_numeroFichierSuivant = $xml->message_suivant['numero'];
$this->_numeroFichierPrecedent = $xml->message_precedent['numero'];
$this->_numeroMessage = $xml->numero;
$this->_nombreTotalMessage = $xml->numero['total_message'];
break;
case 'nombre_messages':
echo $xml[0];
break;
case 'liste_abonnes':
return $xml;
break;
default :
echo $xml;
}
$error = 'Erreur dans l\'acc&egrave;s au fichier:<br />'.$this->chemin_fichier_xml.'<br />';
$error = '';
throw new Exception($error);
}
catch (Exception $e) {
echo $e->getMessage().'<br />';
//echo $this->chemin_fichier_xml;
}
} else {
return parent::parse();
}
}
}
 
?>
/trunk/classes/commande_serveur.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: commande_serveur.class.php,v 1.2 2005/09/27 16:37:40 alexandre_tb Exp $
// CVS : $Id: commande_serveur.class.php,v 1.2 2005-09-27 16:37:40 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/HTML_formulaireInscriptionProjet.class.php
1,115 → 1,115
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireInscriptionProjet.class.php,v 1.3 2007-11-21 09:42:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireInscriptionProjet
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/radio.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php';
 
/**
* class HTML_formulaireInscriptionProjet
*
*/
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
{
/*** Attributes: ***/
 
/**
*
*
* @return void
* @access public
*/
function HTML_formulaireInscriptionProjet( $formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireInscriptionProjet
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire(& $projet )
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
''."\n" ;
$modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n" ;
$squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n");
$squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
$squelette->setElementTemplate( '{element}</li></ul>', 'valider');
$squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
if ($projet->avoirListe()) {
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
// Indisponible pour le moment
//$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
}
$this->addElement ('hidden', 'id_projet', $projet->getId()) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
 
} // end of HTML_formulaireInscriptionProjet
?>
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireInscriptionProjet.class.php,v 1.3 2007-11-21 09:42:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireInscriptionProjet
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/radio.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php';
 
/**
* class HTML_formulaireInscriptionProjet
*
*/
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
{
/*** Attributes: ***/
 
/**
*
*
* @return void
* @access public
*/
function HTML_formulaireInscriptionProjet( $formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireInscriptionProjet
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire(& $projet )
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
''."\n" ;
$modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n" ;
$squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n");
$squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
$squelette->setElementTemplate( '{element}</li></ul>', 'valider');
$squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
if ($projet->avoirListe()) {
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
// Indisponible pour le moment
//$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
}
$this->addElement ('hidden', 'id_projet', $projet->getId()) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
 
} // end of HTML_formulaireInscriptionProjet
?>
/trunk/classes/projetTemplate.class.php
1,89 → 1,89
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: projetTemplate.class.php,v 1.3 2008-08-25 15:04:38 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
/** Constante des templates */
// Pour le coordinateur dans la cas de projets moderes
define ('PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET', 1);
define ('PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS', 2);
 
// Pour le coordinateur lors d une nouvelle inscription (projets non moderes)
define ('PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_SUJET', 3);
define ('PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_CORPS', 4);
 
// pour le coodinateur lors des desinscription
define ('PROJET_TEMPLATE_DESINSCRIPTION_SUJET', 5);
define ('PROJET_TEMPLATE_DESINSCRIPTION_CORPS', 6);
 
// Pour le coordinateur lors du depot d un nouveau document
define ('PROJET_TEMPLATE_NOUVEAU_DOC_SUJET', 7);
define ('PROJET_TEMPLATE_NOUVEAU_DOC_CORPS', 8);
 
// Pour les administrateur lorsque le dernier coordinateur
// d un projet se desinscrit
define ('PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET', 9);
define ('PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS', 10);
 
class projetTemplate extends PEAR {
 
 
var $_db ;
function projetTemplate(&$objetDB) {
$this->_db = $objetDB ;
}
function getTemplate ($id_template, $lang='fr-FR', $argument = 0) {
$requete = 'select pt_template from projet_template where pt_id_template='.$this->_db->escapeSimple($id_template).
' and pt_i18n like "'.$lang.'%"' ;
if ($argument != 0) $requete .= ' and pt_argument='.$this->_db->escapeSimple($argument) ;
$resultat = $GLOBALS['projet_db']->query($requete) ;
if (DB::isError($resultat)) return $this->raiseError ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
if ($resultat->numRows() == 0) return $this->raiseError ('Aucun template avec l\'identifiant: '.$id_template.
', la langue: '.$lang. ' et l argument '.$argument) ;
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pt_template ;
}
}
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: projetTemplate.class.php,v 1.4 2008-09-16 14:10:41 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
/** Constante des templates */
// Pour le coordinateur dans la cas de projets moderes
define ('PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET', 1);
define ('PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS', 2);
 
// Pour le coordinateur lors d une nouvelle inscription (projets non moderes)
define ('PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_SUJET', 3);
define ('PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_CORPS', 4);
 
// pour le coodinateur lors des desinscription
define ('PROJET_TEMPLATE_DESINSCRIPTION_SUJET', 5);
define ('PROJET_TEMPLATE_DESINSCRIPTION_CORPS', 6);
 
// Pour le coordinateur lors du depot d un nouveau document
define ('PROJET_TEMPLATE_NOUVEAU_DOC_SUJET', 7);
define ('PROJET_TEMPLATE_NOUVEAU_DOC_CORPS', 8);
 
// Pour les administrateur lorsque le dernier coordinateur
// d un projet se desinscrit
define ('PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET', 9);
define ('PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS', 10);
 
class projetTemplate extends PEAR {
 
 
var $_db ;
function projetTemplate(&$objetDB) {
$this->_db = $objetDB ;
}
function getTemplate ($id_template, $lang='fr-FR', $argument = 0) {
$requete = 'select pt_template from projet_template where pt_id_template='.$this->_db->escapeSimple($id_template).
' and pt_i18n like "'.$lang.'%"' ;
if ($argument != 0) $requete .= ' and pt_argument='.$this->_db->escapeSimple($argument) ;
$resultat = $GLOBALS['projet_db']->query($requete) ;
if (DB::isError($resultat)) return $this->raiseError ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
if ($resultat->numRows() == 0) return $this->raiseError ('Aucun template avec l\'identifiant: '.$id_template.
', la langue: '.$lang. ' et l argument '.$argument) ;
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pt_template ;
}
}
?>
/trunk/classes/HTML_Liste.class.php
16,7 → 16,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_Liste.class.php,v 1.2 2005/09/27 16:42:00 alexandre_tb Exp $
// CVS : $Id: HTML_Liste.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/projet_type.class.php
1,107 → 1,107
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet_type.class.php,v 1.2 2005/10/14 08:55:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet_type
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_type
{
 
/*** Attributes: ***/
 
/**
* Une connection vers une base de donnée
* @access private
*/
var $_db;
 
/**
* Renvoie tous types de projets (de la table projet_type) ans un tableau avec pour
* clé l'identifiant et pour valeur le label.
*
* @return Array
* @static
* @access public
*/
function getTousLesTypes(& $objetDB )
{
$requete = 'select * from projet_type' ;
return $objetDB->getAssoc ($requete) ;
} // end of member function getTousLesTypes
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_type( & $objetDB )
{
$this->_db = $objetDB ;
} // end of member function projet_type
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_type from projet_type where pt_id_type='.$this->_db->escapeSimple($id_type) ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
} // end of member function projet_type
 
 
 
 
} // end of projet_type
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet_type.class.php,v 1.2 2005-10-14 08:55:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet_type
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_type
{
 
/*** Attributes: ***/
 
/**
* Une connection vers une base de donnée
* @access private
*/
var $_db;
 
/**
* Renvoie tous types de projets (de la table projet_type) ans un tableau avec pour
* clé l'identifiant et pour valeur le label.
*
* @return Array
* @static
* @access public
*/
function getTousLesTypes(& $objetDB )
{
$requete = 'select * from projet_type' ;
return $objetDB->getAssoc ($requete) ;
} // end of member function getTousLesTypes
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_type( & $objetDB )
{
$this->_db = $objetDB ;
} // end of member function projet_type
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_type from projet_type where pt_id_type='.$this->_db->escapeSimple($id_type) ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
} // end of member function projet_type
 
 
 
 
} // end of projet_type
?>
/trunk/classes/HTML_formulaireCouperColler.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireCouperColler.class.php,v 1.2 2005/09/27 16:39:25 alexandre_tb Exp $
// CVS : $Id: HTML_formulaireCouperColler.class.php,v 1.3 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/trunk/classes/ezmlm-php-2.0/ezmlm-repondre.php
1,187 → 1,187
<?php
// $Id: ezmlm-repondre.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
 
class ezmlm_repondre extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
function repondre($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$message = file_get_contents($msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le délimiteur de l'expression régulière
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du répertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print '<br />'."\n";
$this->parse_template($mailDecode, $a2, $a1);
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post', str_replace('&amp;', '&', $this->forcehref).'&action=repondre&'.
'actionargs[]='.$a1.'&actionargs[]='.$a2.'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au début de chaque ligne du message
$tableau = explode ("\n", $this->message_rendu) ;
$this->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $this->message_rendu,
'mail_titre' => 'Re : '.$this->decode_iso ($mailDecode->headers['subject']))) ;
 
print $formulaireReponse->toHTML() ;
 
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
case 'html' : $corps .= $mailDecode->parts[$i]->body ;
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime( $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$corps .= '';
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
//for ($j= 0; $j < count ($profondeur); $j++) $corps .= '&actionargs[]='.$profondeur[$j];
}
/*$corps .= '&actionargs[]='.$i ;
$corps .= '">'.'<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;*/
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime( $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', utf8_decode($this->cleanup_body($mailDecode->body)) , $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
}
}
}
}
 
function ezmlm_repondre() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<ezmlm-body>';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
 
}
<?php
// $Id: ezmlm-repondre.php,v 1.2 2005/09/27 16:43:08 alexandre_tb Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
 
class ezmlm_repondre extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
function repondre($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$message = file_get_contents($msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le délimiteur de l'expression régulière
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du répertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print '<br />'."\n";
$this->parse_template($mailDecode, $a2, $a1);
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post', str_replace('&amp;', '&', $this->forcehref).'&action=repondre&'.
'actionargs[]='.$a1.'&actionargs[]='.$a2.'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au début de chaque ligne du message
$tableau = explode ("\n", $this->message_rendu) ;
$this->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $this->message_rendu,
'mail_titre' => 'Re : '.$this->decode_iso ($mailDecode->headers['subject']))) ;
 
print $formulaireReponse->toHTML() ;
 
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
case 'html' : $corps .= $mailDecode->parts[$i]->body ;
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension, $GLOBALS['projet_db']);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$corps .= '';
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
//for ($j= 0; $j < count ($profondeur); $j++) $corps .= '&actionargs[]='.$profondeur[$j];
}
/*$corps .= '&actionargs[]='.$i ;
$corps .= '">'.'<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;*/
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', utf8_decode($this->cleanup_body($mailDecode->body)) , $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
}
}
}
}
 
function ezmlm_repondre() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<ezmlm-body>';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
 
}
/trunk/classes/ezmlm-php-2.0/ezmlm-author.php
1,5 → 1,5
<?php
// $Id: ezmlm-author.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $
// $Id: ezmlm-author.php,v 1.4 2008-11-19 09:28:46 aperonnet Exp $
//
// ezmlm-author.php - ezmlm-php v2.0
// --------------------------------------------------------------
14,8 → 14,8
//echo $file ;
if (!is_file($this->listdir . $file)) { $this->error(EZMLM_INVALID_AUTHOR); return; }
// Le fichier author comprend
// Premi�re ligne hash_auteur nom_auteur
// num_mess:ann�emois:hash_sujet sujet
// première ligne hash_auteur nom_auteur
// num_mess:annéemois:hash_sujet sujet
$fd = @fopen($this->listdir . $file, "r");
$i = 0 ;
$class = array ('ligne_impaire', 'ligne_paire') ;
30,7 → 30,7
$tableopened = TRUE;
} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) {
// si la ligne est valide
// on r�cup�re le num�ro du message pour en extraire le nom du fichier
// on récupère le numéro du message pour en extraire le nom du fichier
$msgfile = preg_replace('/^([0-9]*):.*/', '\1', $buf);
$msgdir = (int)((int)$msgfile / 100);
$msgfile = (int)$msgfile % 100;
/trunk/classes/ezmlm-php-2.0/ezmlm.php
1,5 → 1,5
<?php
// $Id: ezmlm.php,v 1.5 2007/04/19 15:34:35 neiluj Exp $
// $Id: ezmlm.php,v 1.3.2.2 2007/03/13 11:04:46 alexandre_tb Exp $
//
// ezmlm.php - ezmlm-php v2.0
// --------------------------------------------------------------
30,7 → 30,7
require_once("ezmlm-repondre.php");
require_once("ezmlm-author.php");
 
$GLOBALS['mois'] = array ('Jan', 'F�v', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil', 'Ao�t', 'Sept', 'Oct', 'Nov', 'D�c') ;
$GLOBALS['mois'] = array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') ;
 
// CLASS: ezmlm_php
// the base class, contains common functions and the config
67,15 → 67,15
var $actionargs;
 
function ezmlm_php() {
 
// USER-CONFIG section
// these variables act the same way ezmlm-php-config.php did in the first release
// simply edit these variables to match your setup
 
$this->listdir = "";
$this->listname = "";
$this->listdomain = "";
 
$this->tempdir = "";
 
$this->sendheaders = TRUE;
93,7 → 93,7
"subject",
"date"
);
$this->header_en_francais = array ('to' => 'A',
$this->header_en_francais = array ('to' => 'A',
'from' => 'De',
'subject' => 'Sujet',
'date' => 'Date') ;
118,6 → 118,16
/*$this->error(EZMLM_INVALID_DIR,TRUE);*/
}
}
/*
* Renvoi le nombre de message dans une archive
* Le nombre contenu dans liste/num
*/
function getNumArchive() {
if ($this->listdir != '') {
$num = split(':', file_get_contents($this->listdir.'/num'));
return $num[0];
}
}
 
function set_action($action) {
if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
179,8 → 189,8
print "</body>\n";
print "</html>\n";
}
 
 
// begin common functions
 
// makehash - generates an author hash using the included makehash program
233,6 → 243,15
$outstr = preg_replace("/&lt;.*&gt;/", '', $outstr);
$outstr = preg_replace("/[\"']/", '', $outstr);
}
 
$at_split = explode('@',$outstr);
$outstr = $at_split[0];
 
$points_sep = explode('.',$outstr);
if(count($points_sep) > 2) {
$outstr = implode('.', array_slice($points_sep,0,count($points_sep) - 2));
$outstr = rtrim($outstr, '.').'...';
}
return trim($outstr);
}
 
254,13 → 273,13
if ($critical) { die; }
}
/**
* Parse une chaime et supprime les probl�me d'encodage de type ISO-4 ...
* Parse une chaine et supprime les probleme d'encodage de type ISO-4 ...
*
* @return string
*/
 
function decode_iso ($chaine) {
 
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
$reg_exp = $nombre[0] ;
$chaine = str_replace(' ', '', $chaine);
270,7 → 289,7
if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER) ;
for ($i = 0; $i < count ($match[0]); $i++ ) {
 
if (strtoupper($match[1][$i]) == 'Q') {
$decode = quoted_printable_decode ($match[2][$i]) ;
} elseif ($match[1][$i] == 'B') {
279,23 → 298,23
$decode = preg_replace ("/_/", " ", $decode) ;
if ($reg_exp == 'UTF-8') {
$decode = utf8_decode ($decode) ;
}
}
$chaine = str_replace ($match[0][$i], $decode, $chaine) ;
}
return $chaine ;
}
 
/**
*
*
* @return
*/
 
function date_francaise ($date_mail) {
$date_mail = preg_replace ('/\(?CEST\)?/', '', $date_mail) ;
$date_mail = preg_replace ('/CEST/', '', $date_mail) ;
$numero_mois = date('m ', strtotime($date_mail)) - 1 ;
$date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois
$date .= date(' Y ', strtotime($date_mail)) ; // l'ann�e
$date .= date(' Y ', strtotime($date_mail)) ; // l'annee
if (date('a', strtotime($date_mail)) == 'pm') {
$date .= (int) date('g', strtotime($date_mail)) + 12 ; // Les heures
} else {
304,8 → 323,8
$date .= date(':i', strtotime($date_mail)) ; // Les minutes
return $date ;
}
/**
 
/**
* Cette fonction renvoie le prefixe, cad 0 ou rien
* d un nom de message, ex : pour 09, on renvoie 0
* pour 12 on renvoie rien
/trunk/classes/ezmlm-php-2.0/services_vpopmail/derniers_messages.php
1,90 → 1,93
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
if (!file_exists($info->listdir.'/num')) {
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml;
exit();
}
 
$html = $info->show_recentmsgs() ;
 
if (!$html) {
if (!$info) {
echo 'Les fichiers de la liste ne sont pas visibles sur le serveur' ;
exit();
}
}
 
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: derniers_messages.php,v $
* Revision 1.5 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.4 2008-08-25 15:25:09 alexandre_tb
* optimisation et gestion des erreurs
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
date_default_timezone_set("Europe/Paris");
// extract($_GET); // PHP-5.4, sans register_globals
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
if (!file_exists($info->listdir.'/num')) {
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml;
exit();
}
 
$html = $info->show_recentmsgs() ;
 
if (!$html) {
if (!$info) {
echo 'Les fichiers de la liste ne sont pas visibles sur le serveur' ;
exit();
}
}
 
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.4 2008-08-25 15:25:09 alexandre_tb
* optimisation et gestion des erreurs
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/classes/ezmlm-php-2.0/services_vpopmail/ajout_abonne.php
2,5 → 2,5
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
echo exec ('/usr/local/bin/ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
?>
/trunk/classes/ezmlm-php-2.0/services_vpopmail/messages_mois.php
1,101 → 1,101
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: messages_mois.php,v 1.4 2008-11-04 17:11:10 aperonnet Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
 
 
/** Calcul du cache */
 
require_once('Cache/Lite.php');
 
// Set a id for this cache
$id = 'cachemonth_'.$domaine.'_'.$liste.'_'.$actionargs[0];
 
// Set a few options
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 360000
);
 
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
 
if ($xml = $Cache_Lite->get($id)) {
} else {
include_once 'XML/Util.php' ;
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
$html = $info->show_month($actionargs[0]);
if (!$html) {
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ \'Les fichiers de la liste ne sont pas visibles sur le serveur\']]>';
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
} else {
$xml .= XML_Util::createStartElement ('ezmlm_messages_mois', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ '.$html.']]>';
$xml .= XML_Util::createEndElement('ezmlm_messages_mois') ;
$Cache_Lite->save($xml);
}
}
header ('Content-type: text/xml');
echo $xml ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: messages_mois.php,v $
* Revision 1.4 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.3 2008-08-25 15:24:09 alexandre_tb
* ajout de la gestion du cache
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: messages_mois.php,v 1.4 2008-11-04 17:11:10 aperonnet Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
date_default_timezone_set("Europe/Paris");
// extract($_GET); // PHP-5.4, sans register_globals
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
 
 
/** Calcul du cache */
 
require_once('Cache/Lite.php');
 
// Set a id for this cache
$id = 'cachemonth_'.$domaine.'_'.$liste.'_'.$actionargs[0];
 
// Set a few options
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 360000
);
 
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
 
if ($xml = $Cache_Lite->get($id)) {
} else {
include_once 'XML/Util.php' ;
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
$html = $info->show_month($actionargs[0]);
if (!$html) {
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ \'Les fichiers de la liste ne sont pas visibles sur le serveur\']]>';
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
} else {
$xml .= XML_Util::createStartElement ('ezmlm_messages_mois', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ '.$html.']]>';
$xml .= XML_Util::createEndElement('ezmlm_messages_mois') ;
$Cache_Lite->save($xml);
}
}
header ('Content-type: text/xml');
echo $xml ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2008-08-25 15:24:09 alexandre_tb
* ajout de la gestion du cache
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/classes/ezmlm-php-2.0/services_vpopmail/messages_thread.php
1,74 → 1,76
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: messages_thread.php,v 1.4 2008-11-04 17:11:10 aperonnet Exp $
/**
* Application projet
*
* Renvoie les messages d un thread
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_threads();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
$info->tempdir = '/home/vpopmail/www/tmp' ;
$html = $info->load($actionargs[0]) ;
if (!$html) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_thread', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_thread') ;
header ('Content-type: text/xml');
echo $xml ;
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: messages_thread.php,v $
* Revision 1.4 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.3 2008-08-26 09:26:41 alexandre_tb
* ajout commentaire
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: messages_thread.php,v 1.5 2008-11-19 09:28:45 aperonnet Exp $
/**
* Application projet
*
* Renvoie les messages d un thread
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
// extract($_GET); // PHP-5.4, sans register_globals
 
// Parametrage de la liste
$info = new ezmlm_threads();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
$info->tempdir = '/home/vpopmail/www/tmp' ;
$html = $info->load($actionargs[0]) ;
if (!$html) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_thread', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_thread') ;
header ('Content-type: text/xml');
echo $xml ;
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.3 2008-08-26 09:26:41 alexandre_tb
* ajout commentaire
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/classes/ezmlm-php-2.0/services_vpopmail/calendrier_messages.php
1,7 → 1,44
<?php
 
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: calendrier_messages.php,v 1.4 2008-08-25 15:25:47 alexandre_tb Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
date_default_timezone_set("Europe/Paris");
// extract($_GET); // PHP-5.4, sans register_globals
 
// Parametrage de la liste
$info = new ezmlm_threads();
11,22 → 48,85
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->listmessages()) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
/** Calcul du cache */
/*
require_once('Cache/Lite.php');
 
// Set a id for this cache
$id = 'cache_'.$domaine.'_'.$liste;
 
// Set a few options
 
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => null
);
*/
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
if (!file_exists($info->listdir.'/num')) {
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
header ('Content-type: text/xml');
echo $xml;
exit();
}
/*
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
$recalcule = false ;
$Cache_Lite->get($id);
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
$recalcule = true;
}
 
// Test if thereis a valide cache for this id
if (!$recalcule) {
$xml = $Cache_Lite->get($id);
} else { // pas de cache, on construit le calendrier
*/
$html = $info->listmessages();
 
if (!$html) {
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[Les fichiers de la liste ne sont pas visibles sur le serveur]]>';
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
} else {
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ '.$html.']]>';
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
/*
$xml .= XML_Util::createStartElement('cache_time') ;
$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
$xml .= XML_Util::createEndElement('cache_time') ;*/
//$Cache_Lite->save($xml, $id);
}
//}
 
header ('Content-type: text/xml');
echo $xml ;
?>
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: calendrier_messages.php,v $
* Revision 1.4 2008-08-25 15:25:47 alexandre_tb
* optimisation et gestion du cache
*
* Revision 1.3 2008-06-09 10:05:28 alexandre_tb
* Ajout de la gestion du cache
* dependance avec Cache_Lite
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/trunk/classes/ezmlm-php-2.0/ezmlm-listinfo.php
1,197 → 1,235
<?php
// $Id: ezmlm-listinfo.php,v 1.5 2008-11-04 17:11:10 aperonnet Exp $
//
// ezmlm-listinfo.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Displays general list info in the format of a welcome page.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
 
class ezmlm_listinfo extends ezmlm_php {
 
function ezmlm_listinfo () {
return is_dir($this->listdir.'/archive/0') ;
}
function display() {
if (!is_dir($this->listdir.'/archive/0')) { // On teste si il y a au moins un message, cad le r�pertoire 0
echo $this->listdir.'/archive/0' ;
return false ;
}
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
//$this->show_info_file();
$threads = new ezmlm_threads();
$threads->listdir = $this->listdir ;
$threads->listname = $this->listname ;
$threads->forcehref = $this->forcehref ; /// ajout alex
$threads->listmessages() ;
$this->show_recentmsgs();
return true ;
}
 
function show_info_file() {
if (@is_file($this->listdir . "/text/info")) {
$infofile = @file($this->listdir . "/text/info");
while (list($line_num, $line) = each($infofile)) {
print nl2br($line);
}
}
}
 
 
function show_recentmsgs($title = "Messages r�cents") {
if (!is_dir($this->listdir.'/archive/0')) return false;
$html = '' ;
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$recent = $parser->recent_msgs();
// le tableau recent est de la forme
// $recent[numero_message][1] sujet
// $recent[numero_message][2] date en anglais => (22 May 2006)
// $recent[numero_message][3] le hash de l auteur
// $recent[numero_message][4] auteur
$class = array ('ligne_paire', 'ligne_impaire') ;
while (list($key,$val) = each($recent)) {
$html .= '<tr class="'.$class[$ctc].'">'."\n";
//print '<td>'.$val->nummessage.'</td>' ;
// $key contient le numero du message tel que dans les fichiers d index par ex 216
// on retrouve le nom du repertoire et le nom du fichier
$decimal = (string) $key;
if ($key >= 100) {
$fichier_message = substr($decimal, -2) ;
$repertoire_message = substr ($decimal, 0, -2) ;
} else {
if ($key < 10) {
$fichier_message = '0'.$key;
} else {
$fichier_message = $decimal;
}
$repertoire_message = '0';
}
$html .= '<td>'.$key.'</td>' ;
$html .= '<td>';
 
$from = $val[4];
 
$html .= $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false)));
$html .= "</td>\n";
$html .= '<td><b>';
$actionargs = preg_split("/\//", $val->msgfile);
$html .= $this->makelink("action=show_msg&actionargs[]=".$repertoire_message.
"&actionargs[]=".$fichier_message ,$this->decode_iso($val[1]));
 
$html .= "</b></td>\n";
//print '<td>'.$this->date_francaise($val[2]).'</td>'."\n";
$html .= '<td>'.$val[2].'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
$html .= '</table>'."\n";
return $html;
}
function show_month ($month) {
// Le nom du fichier est ann�emoi ex 200501 pour janvier 2005
// le html est vide au début
$html = '' ;
// on ouvre chaque fichier en lecture
if(!file_exists($this->listdir . '/archive/threads/' . $month)) {
return false ;
}
$fd = file_get_contents($this->listdir . '/archive/threads/' . $month, 'r');
$fichier = explode ("\n", $fd) ;
// on r�cup�re la premi�re ligne
$premiere_ligne = $fichier[0] ;
$derniere_ligne = $fichier[count($fichier)-2];
preg_match ('/[0-9]+/', $premiere_ligne, $match) ;
$numero_premier_mail = $match[0] ;
preg_match ('/[0-9]+/', $derniere_ligne, $match1) ;
$numero_dernier_mail = $match1[0] ;
// On cherche le r�pertoire du premier mail
$repertoire_premier_mail = (int) ($numero_premier_mail / 100) ;
// petite verification de coherence
if ($numero_premier_mail > $numero_dernier_mail) {
$temp = $numero_premier_mail;
$numero_premier_mail = $numero_dernier_mail ;
$numero_dernier_mail = $temp;
}
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$class = array ('ligne_paire', 'ligne_impaire') ;
for ($i = $numero_premier_mail, $compteur = $numero_premier_mail ; $compteur <= $numero_dernier_mail; $i++, $compteur++) {
if ($i > 99) {
$multiplicateur = (int) ($i / 100) ;
// pour les nails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100
$i = $i - $multiplicateur * 100 ;
}
if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ;
if (file_exists($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) {
$mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ;
$mailDecode = $mimeDecode->decode() ;
if ($i == 99) {
$repertoire_premier_mail++;
$i = -1;
}
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>';
$hash = $this->makehash($mailDecode->headers['from']);
$html .= $this->makelink("action=show_author_msgs&actionargs[]=".
$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= "</td>\n";
$html .= '<td><b>';
$actionargs[0] = $repertoire_premier_mail ;
$actionargs[1] = $num_message ;
if (count ($actionargs) > 1) {
$html .= $this->makelink("action=show_msg&actionargs[]=".
$actionargs[(count($actionargs) - 2)] .
"&actionargs[]=".
$actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
}
$html .= "</b></td>\n";
$html .= '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
}
$html .= '</table>'."\n";
return $html;
}
}
<?php
// $Id: ezmlm-listinfo.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $
//
// ezmlm-listinfo.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Displays general list info in the format of a welcome page.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
 
class ezmlm_listinfo extends ezmlm_php {
 
function ezmlm_listinfo () {
//return is_dir($this->listdir.'/archive/0') ;
}
function display() {
if (!is_dir($this->listdir.'/archive/0')) { // On teste si il y a au moins un message, cad le répertoire 0
echo $this->listdir.'/archive/0' ;
return false ;
}
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
//$this->show_info_file();
$threads = new ezmlm_threads();
$threads->listdir = $this->listdir ;
$threads->listname = $this->listname ;
$threads->forcehref = $this->forcehref ; /// ajout alex
$threads->listmessages() ;
$this->show_recentmsgs();
return true ;
}
 
function show_info_file() {
if (@is_file($this->listdir . "/text/info")) {
$infofile = @file($this->listdir . "/text/info");
while (list($line_num, $line) = each($infofile)) {
print nl2br($line);
}
}
}
 
 
function show_recentmsgs($title = "Messages récents") {
if (!is_dir($this->listdir.'/archive/0')) return false;
$html = '' ;
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$recent = $parser->recent_msgs();
// le tableau recent est de la forme
// $recent[numero_message][1] sujet
// $recent[numero_message][2] date en anglais => (22 May 2006)
// $recent[numero_message][3] le hash de l auteur
// $recent[numero_message][4] auteur
$class = array ('ligne_paire', 'ligne_impaire') ;
while (list($key,$val) = each($recent)) {
$html .= '<tr class="'.$class[$ctc].'">'."\n";
//print '<td>'.$val->nummessage.'</td>' ;
// $key contient le numero du message tel que dans les fichiers d index par ex 216
// on retrouve le nom du repertoire et le nom du fichier
$decimal = (string) $key;
if ($key >= 100) {
$fichier_message = substr($decimal, -2) ;
$repertoire_message = substr ($decimal, 0, -2) ;
} else {
if ($key < 10) {
$fichier_message = '0'.$key;
} else {
$fichier_message = $decimal;
}
$repertoire_message = '0';
}
$html .= '<td>'.$key.'</td>' ;
$html .= '<td>';
 
$from = $val[4];
 
$html .= $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false)));
$html .= "</td>\n";
$html .= '<td><b>';
$actionargs = preg_split("/\//", $val->msgfile);
$html .= $this->makelink("action=show_msg&actionargs[]=".$repertoire_message.
"&actionargs[]=".$fichier_message ,$this->decode_iso($val[1]));
 
$html .= "</b></td>\n";
//print '<td>'.$this->date_francaise($val[2]).'</td>'."\n";
$html .= '<td>'.$val[2].'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
$html .= '</table>'."\n";
return $html;
}
// month = yyyymm
function show_month ($month) {
$html = '' ;
// on ouvre chaque fichier en lecture
if(!file_exists($this->listdir . '/archive/threads/' . $month)) {
return false ;
}
$numeros_mails_mois = $this->calculerNumMessagesDansMois($month);
 
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$class = array ('ligne_paire', 'ligne_impaire') ;
 
if(count($numeros_mails_mois) > 0) {
$repertoire_premier_mail = (int) (reset($numeros_mails_mois) / 100) ;
}
foreach ($numeros_mails_mois as $num_message) {
 
$i = $num_message;
 
if ($i > 99) {
$multiplicateur = (int) ($i / 100) ;
// pour les mails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100
$i = $i - $multiplicateur * 100 ;
}
 
if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ;
if (file_exists($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) {
$mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ;
$mailDecode = $mimeDecode->decode() ;
 
if ($i == 99) {
$repertoire_premier_mail++;
$i = -1;
}
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>';
$hash = $this->makehash($mailDecode->headers['from']);
$html .= $this->makelink("action=show_author_msgs&actionargs[]=".
$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= "</td>\n";
$html .= '<td><b>';
$actionargs[0] = $repertoire_premier_mail ;
$actionargs[1] = $num_message ;
if (count ($actionargs) > 1) {
$html .= $this->makelink("action=show_msg&actionargs[]=".
$actionargs[(count($actionargs) - 2)] .
"&actionargs[]=".
$actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
}
$html .= "</b></td>\n";
$html .= '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
}
 
$html .= '</table>'."\n";
 
return $html;
}
 
private function calculerNumMessagesDansMois($mois) {
 
$fd = file_get_contents($this->listdir . '/archive/threads/'.$mois, 'r');
$fichier = explode ("\n", $fd) ;
 
$premiere_ligne = $fichier[0] ;
 
$nb_lignes_fichier = count($fichier);
 
$lignes_messages = array();
preg_match ('/[0-9]+/', $premiere_ligne, $match) ;
$numero_premier_mail = $match[0] ;
 
$lignes_messages[$numero_premier_mail] = $numero_premier_mail;
 
foreach($fichier as $ligne) {
 
if(trim($ligne == '')) { continue ;}
 
$ligne_tableau = explode(' ', $ligne);
$num_mail_sujet = explode(':',$ligne_tableau[0]);
$num_sujet = $num_mail_sujet[1];
 
$fd_sujet = file_get_contents($this->listdir.'/archive/subjects/'.substr($num_sujet,0,2).'/'.substr($num_sujet,2,strlen($num_sujet) - 1), 'r');
$premiere_ligne = true;
 
$fichier_sujet = explode ("\n", $fd_sujet) ;
foreach($fichier_sujet as $ligne_sujet) {
 
if($premiere_ligne || trim($ligne_sujet) == '') {$premiere_ligne = false; continue; }
$ligne_tableau_sujet = explode(':', $ligne_sujet);
$num_mail = $ligne_tableau_sujet[0];
$mois_ligne = $ligne_tableau_sujet[1];
if($mois_ligne == $mois) {
if(is_numeric($num_mail)) {
$lignes_messages[$num_mail] = $num_mail;
} else {
$num_mail = preg_replace('/[^0-9]+/','', $num_mail) ;
$lignes_messages[$num_mail] = $num_mail;
}
}
}
}
 
asort($lignes_messages);
return $lignes_messages;
}
}
?>
/trunk/classes/ezmlm-php-2.0/makehash
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/classes/ezmlm-php-2.0/ezmlm-threads.php
1,464 → 1,492
<?php
// $Id: ezmlm-threads.php,v 1.6 2008-08-25 15:19:15 alexandre_tb Exp $
//
// ezmlm-threads.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Builds, maintains & displays thread caches
// These cache files live in $ezmlm->tmpdir and are serialized
// php objects that can be unserialized and displayed easily
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("ezmlm-parser.php");
require_once ('ezmlm-langue-fr.php');
 
// CLASS: ezmlm_threads will build, maintain & display thread files (even if a thread is only 1 msg)
class ezmlm_threads extends ezmlm_php {
 
// load: this is the main function that should be called.
// it first checks to see if the cache files are stale, if they are it calls build
// other wise it loads them and calls display
function load($month) {
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum";
} else {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum";
}
$md5 = '' ;
if (!is_file($checksum)) {
$this->build($month);
} else {
$fd = fopen($checksum,"r");
while (!preg_match('/^md5:/', $md5)) { $md5 = fgets($fd,4096); }
fclose($fd);
$md5 = rtrim(preg_replace('/^md5:/', '', $md5), "\n");
if ($md5 != $this->md5_of_file($this->listdir . "/archive/threads/" . $month)) {
print "<!-- $md5 ne " . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . " -->\n";
$this->build($month);
}
}
$html = $this->display($month);
return $html ;
}
 
// display: this loads each cache file sequentially and displays the messages in them
// there is no checking of checksum's done here so load() is the preferred method to
// view the threads
function display($month) {
$html = '' ;
$seq = 0;
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month;
} else {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month;
}
// Le lien par date et par thread
$html .= '[ '.$this->makelink('action=show_month&amp;actionargs[]='.$month, 'par date').' ]' ;
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
// remplac� par le tableau globals $mois dans ezmlm.php
$html .= '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1) -1] .', ' . substr($month,0,4) . '</h2>'."\n";
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$html .= '<tr><td colspan="3"><hr /></td></tr>'."\n";
$ctc .= 0;
 
if (is_file($cache)) {
include($cache);
}
$html .= '<tr><td colspan="3"></td></tr>'."\n";
$html .= '</table>'."\n";
return $html ;
}
 
 
function thread_to_html($thread) {
$html = '';
$lastdepth = -1;
$ctc = 0 ;
$thread_curr = $thread;
$class = array ('ligne_paire', 'ligne_impaire') ;
while ($thread_curr != NULL) {
preg_match ('!/archive/([0-9]*)/([0-9]*)!', $thread_curr->file, $match) ;
if (!isset($GLOBALS['fichiers_analyses'][$match[1]][$match[2]])) {
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
//$msg = new ezmlm_parser();
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE);
} else {
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ;
}
$actionargs = preg_split("/\//", $thread_curr->file);
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>';
$html .= $this->makelink('action=show_author_msgs&amp;actionargs[]='.
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= '</td>'."\n";
$html .= '<td><b>';
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi �a sert ?
for ($i = 0; $i < $thread_curr->depth; $i++) {
$html .= "&nbsp;&nbsp;";
}
if (($this->thread_subjlen > 0) and (strlen($this->decode_iso($mailDecode->headers['subject'])) > $this->thread_subjlen)) {
$subject = substr($this->decode_iso($mailDecode->headers['subject']), 0, ($this->thread_subjlen - 3 - ($thread_curr->depth * 2)));
$subject = $subject . "...";
} else {
$subject = $this->decode_iso($mailDecode->headers['subject']);
}
 
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
$html .= $this->makelink("action=show_msg&amp;actionargs[]=" . $actionargs[2] . "&amp;actionargs[]=" . $actionargs[3], $subject);
$html .= "</b></td>\n";
$html .= '<td>' .$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == count($this->tablecolours)) { $ctc = 0; }
 
$lastdepth = $thread_curr->depth;
$thread_curr = $thread_curr->next;
}
 
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n";
return $html;
}
 
// build: takes one argument in the format YYYYMM and builds the thread cache file
// for that month if the ezmlm thread file exists. The resulting cache file is then
// stored in $this->tmpdir;
function build($month) {
if (!is_file($this->listdir . "/archive/threads/" . $month)) { return FALSE; }
 
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month,"w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month,"w+");
}
fclose($fd2);
$i=0;
// ouverture du fichier thread de ezmlm
// Ils sont class�s mois par mois
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r");
while (!feof($fd1)) {
$line = fgets($fd1,4096);
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) {
// valid ezmlm thread file entry
// On place dans $subjectfile le chemin vers le fichier sujet
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line);
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18);
 
$thread_head = NULL;
$thread_curr = NULL;
$thread_temp = NULL;
$thread_depth = 1;
 
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; }
// on ouvre le fichier sujet
// Celui-ci contient sur la premi�re ligne le hash du sujet puis le sujet
// sur les autres lignes :
// num_message:ann�emois:hash_auteur nom_auteur
$fd2 = fopen($this->listdir . "/archive/subjects/" . $subjectfile, "r");
while (!feof($fd2)) {
$line2 = fgets($fd2,4096);
if (preg_match('/^[0-9]/',$line2)) {
$msgnum = preg_replace('/^([0-9]*):.*/', '\\1', $line2);
$msgfile = $msgnum % 100;
$msgdir = (int)($msgnum / 100);
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
//$msg = new ezmlm_parser();
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE);
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
// On stocke le fichier analys�e pour r�utilisation ult�rieure
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ;
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : '');
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
$references = (isset ($mailDecode->headers['references']) ? $mailDecode->headers['references'] : '') ;
$thread_depth = 1;
 
if ($thread_head == NULL) {
$thread_head = new ezmlm_thread(0,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
} else {
$thread_curr = new ezmlm_thread($depth,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
if ($inreply != '') { $thread_curr->inreply = $inreply; }
if ($references != '') { $thread_curr->references = $references; }
$thread_head->append($thread_curr);
}
}
}
fclose($fd2);
 
// so now after all that mess $thread_head contains a full thread tree
// first build the depth of each message based on 'in-reply-to' and 'references'
unset($thread_temp);
$thread_temp = NULL;
$thread_curr =& $thread_head->next;
while (get_class($thread_curr) == 'ezmlm_thread') {
unset($thread_temp);
$thread_temp = NULL;
 
if ($thread_curr->inreply != '') { $thread_temp =& $thread_head->find_msgid($thread_curr->inreply); }
if ($thread_temp == NULL) {
if ($thread_curr->references != '') {
$refs = preg_split('/ /', $thread_curr->references);
$refs = array_pop($refs);
$thread_temp =& $thread_head->find_msgid($refs);
}
}
if ($thread_temp == NULL) {
// we couldn't find anything... set depth to 1, the default
$thread_curr->depth = 1;
} else {
// we found a reference, set it to it's depth + 1
$thread_curr->depth = $thread_temp->depth + 1;
}
$thread_curr =& $thread_curr->next;
}
 
// now write it to a temp file named MONTH-SEQ where seq is cronologic sequence order of the thread.
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
@mkdir($this->tempdir . "/ezmlm-php-" . $this->listname, 0755);
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month, "a");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
fputs($fd2,$this->thread_to_html($thread_head));
fclose($fd2);
}
}
 
// finally store our checksum
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum","w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum","w+");
}
fputs($fd2,"md5:" . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . "\n");
fclose($fd2);
fclose($fd1);
 
return TRUE;
}
 
// listmessages: prints out a nice little calendar and displays the message
// totals for each month. The link jumps to the thread listing.
// On lit le repetoire archive/threads/ qui contient un fichier par moi avec tous les thread, par sujet
// Presentes comme suit
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
// les messages sont ranges par leur numero
function listmessages() {
if (!is_dir($this->listdir . "/archive/threads/")) {
return false ;
}
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
$res .=" </tr>\n";
$res .= $this->calendrierMessage();
$res .= "</table>\n";
return $res;
/*
$threadcount = array();
 
$repertoire_archive = opendir($this->listdir . "/archive/");
$tableau_annee = array();
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r');
$compteur = 0 ;
while (!feof($fichier_index)) {
// On ignore la premiere ligne
$temp = fgets($fichier_index, 4096);
// dans la seconde on recupere la date
$temp = fgets($fichier_index, 4096);
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ;
if ($match[0] != '') {
$threadmonth = date('n', strtotime($match[0])) ;
$threadyear = date('Y', strtotime($match[0])) ;
$threadcount[$threadyear][$threadmonth]++;
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
}
}
fclose ($fichier_index);
}
}
if (count($threadcount) == 0) return 'Il n\y a pas de messages dans les archives';
// La partie qui suit, simple, cree la table avec le nombre de message echange chaque mois
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
$res .=" </tr>\n";
arsort($tableau_annee);
foreach ($tableau_annee as $annee) {
$res .= " <tr>\n";
$res .= ' <td class="col_annee">'.$annee.'</td>';
for ($i = 1; $i <= 12; $i++) {
$res .= '<td class="mois">';
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
}
$res .= '</td>';
}
$res .= '</tr>'."\n";
}
$res .= "</table>\n";
return $res ;
*/
}
/*
* Cree un fichier liste.calendrierPermanent qui contient
* le nombre de message par mois pour toutes les annees
* depuis le debut de la liste sauf la derniere
*
*/
function calculeCalendrierPermanent($Annnee = '') {
$numArchive = $this->getNumArchive();
$dernierRepertoire = floor($numArchive / 100);
$threadcount = array();
$tableau_annee = array();
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
 
// On parcours le fichier a l envers
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $fichier_index[$j], $match) ;
if ($match[0] != '') {
$threadmonth = date('n', strtotime($match[0])) ;
$threadyear = date('Y', strtotime($match[0])) ;
if ($Annnee != '') {
if ($threadyear < date('Y')) {
$sortir = true;
break;
}
} else {
if ($threadyear == date('Y')) continue;
}
$threadcount[$threadyear][$threadmonth]++;
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
}
}
if ($sortir) break;
}
$res = '';
arsort($tableau_annee);
foreach ($tableau_annee as $annee) {
$res .= " <tr>\n";
$res .= ' <td class="col_annee">'.$annee.'</td>';
for ($i = 1; $i <= 12; $i++) {
$res .= '<td class="mois">';
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
}
$res .= '</td>';
}
$res .= '</tr>'."\n";
}
return $res;
}
function ecrireFichierCalendrier() {
$html = $this->calculeCalendrierPermanent();
$f = fopen ('tmp/'.$this->listname.'.calendrier', 'w') ;
fwrite ($f, $html);
fclose($f);
return $html;
}
function calendrierMessage() {
$html = '';
// On ajoute la derniere annee
$html .= $this->calculeCalendrierPermanent(date ('Y'));
if ($this->isFichierCalendrierExiste()) {
// S il existe mais qu il est trop vieux, il faut le recalculer
if ($this->isDoitRecalculerCalendrier()) {
$annees = $this->getAnneesARecalculer();
$html .= $this->calculeCalendrierPermanent($annees);
}
$html .= file_get_contents('tmp/'.$this->listname.'.calendrier');
} else {
$html .= $this->ecrireFichierCalendrier();
}
return $html;
}
function isFichierCalendrierExiste() {
if (file_exists('tmp/'.$this->listname.'.calendrier')) {
return true;
}
return false;
}
function isDoitRecalculerCalendrier() {
 
if (date ('Y', fileatime('tmp/'.$this->listname.'.calendrier')) != date('Y')) return true;
return false;
}
function getAnneesARecalculer() {
// On suppose que l index de ezmlm est correct
$anneeFichierCalendrier = date ('Y', fileatime('tmp/'.$this->listname.'.calendrier'));
return $anneeFichierCalendrier + 1;
}
}
 
// CLASS: ezmlm-thread is a quick little class to allow us to define
// a structure of the current thread in a single-linked list.
// it's a little messy since php doesn't support pointers like C does
// so we have to use references and a head object to append to the list.
class ezmlm_thread {
var $next;
var $depth;
var $file;
var $msgid;
var $inreply;
var $references;
function append($thread) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
$thread_curr =& $thread_curr->next;
}
$thread_curr->next = $thread;
}
function &find_msgid($msgid) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
if (trim($thread_curr->msgid) == trim($msgid)) { return $thread_curr; }
$thread_curr =& $thread_curr->next;
}
return NULL;
}
function ezmlm_thread($depth,$file,$msgid) {
$this->depth = $depth;
$this->file = $file;
$this->msgid = $msgid;
$this->next = NULL;
}
}
?>
<?php
// $Id: ezmlm-threads.php,v 1.7 2008-11-19 09:28:46 aperonnet Exp $
//
// ezmlm-threads.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Builds, maintains & displays thread caches
// These cache files live in $ezmlm->tmpdir and are serialized
// php objects that can be unserialized and displayed easily
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("ezmlm-parser.php");
require_once ('ezmlm-langue-fr.php');
 
// CLASS: ezmlm_threads will build, maintain & display thread files (even if a thread is only 1 msg)
class ezmlm_threads extends ezmlm_php {
 
// load: this is the main function that should be called.
// it first checks to see if the cache files are stale, if they are it calls build
// other wise it loads them and calls display
function load($month) {
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum";
} else {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum";
}
$md5 = '' ;
if (!is_file($checksum)) {
$this->build($month);
} else {
$fd = fopen($checksum,"r");
while (!preg_match('/^md5:/', $md5)) { $md5 = fgets($fd,4096); }
fclose($fd);
$md5 = rtrim(preg_replace('/^md5:/', '', $md5), "\n");
if ($md5 != $this->md5_of_file($this->listdir . "/archive/threads/" . $month)) {
print "<!-- $md5 ne " . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . " -->\n";
$this->build($month);
}
}
$html = $this->display($month);
return $html ;
}
 
// display: this loads each cache file sequentially and displays the messages in them
// there is no checking of checksum's done here so load() is the preferred method to
// view the threads
function display($month) {
$html = '' ;
$seq = 0;
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month;
} else {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month;
}
// Le lien par date et par thread
$html .= '[ '.$this->makelink('action=show_month&amp;actionargs[]='.$month, 'par date').' ]' ;
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
// remplacé par le tableau globals $mois dans ezmlm.php
$html .= '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1) -1] .', ' . substr($month,0,4) . '</h2>'."\n";
 
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$html .= '<tr><td colspan="3"><hr /></td></tr>'."\n";
$ctc .= 0;
 
if (is_file($cache)) {
$html .= file_get_contents($cache);
}
$html .= '<tr><td colspan="3"></td></tr>'."\n";
$html .= '</table>'."\n";
 
return $html ;
}
 
 
function thread_to_html($thread) {
$html = '';
$lastdepth = -1;
$ctc = 0 ;
$thread_curr = $thread;
$class = array ('ligne_paire', 'ligne_impaire') ;
while ($thread_curr != NULL) {
preg_match ('!/archive/([0-9]*)/([0-9]*)!', $thread_curr->file, $match) ;
if (!isset($GLOBALS['fichiers_analyses'][$match[1]][$match[2]])) {
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
//$msg = new ezmlm_parser();
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE);
 
} else {
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ;
}
$actionargs = preg_split("/\//", $thread_curr->file);
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>';
$html .= $this->makelink('action=show_author_msgs&amp;actionargs[]='.
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= '</td>'."\n";
$html .= '<td><b>';
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi ça sert ?
for ($i = 0; $i < $thread_curr->depth; $i++) {
$html .= "&nbsp;&nbsp;";
}
if (($this->thread_subjlen > 0) and (strlen($this->decode_iso($mailDecode->headers['subject'])) > $this->thread_subjlen)) {
$subject = substr($this->decode_iso($mailDecode->headers['subject']), 0, ($this->thread_subjlen - 3 - ($thread_curr->depth * 2)));
$subject = $subject . "...";
} else {
$subject = $this->decode_iso($mailDecode->headers['subject']);
}
 
 
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
$html .= $this->makelink("action=show_msg&amp;actionargs[]=" . $actionargs[2] . "&amp;actionargs[]=" . $actionargs[3], $subject);
$html .= "</b></td>\n";
$html .= '<td>' .$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == count($this->tablecolours)) { $ctc = 0; }
 
$lastdepth = $thread_curr->depth;
$thread_curr = $thread_curr->next;
}
 
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n";
return $html;
}
 
// TODO: Fonction à tester et compléter
// Construit un index de tous les messages envoyés dans une liste donnée pour un mois
// au format YYYYMM
/* // commenté sur le serveur
function build_month_list($date)
{
$months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug',
9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec');
 
$month = $months[((int)substr($month,4,2) / 1) -1] ;
$year = substr($month,0,4) ;
$numArchive = $this->getNumArchive();
$dernierRepertoire = floor($numArchive / 100);
 
$threads = array();
 
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
 
// On parcourt le fichier a l envers
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
$match = strpos($fichier_index[$j],$month.' '.$year) ;
if ($match) {
 
$threads[] = $fichier_index[$j-1] ;
 
}
}
}
}
*/
 
// build: takes one argument in the format YYYYMM and builds the thread cache file
// for that month if the ezmlm thread file exists. The resulting cache file is then
// stored in $this->tmpdir;
function build($month) {
if (!is_file($this->listdir . "/archive/threads/" . $month)) { return FALSE; }
 
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month,"w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month,"w+");
}
fclose($fd2);
$i=0;
// ouverture du fichier thread de ezmlm
// Ils sont classés mois par mois
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r");
while (!feof($fd1)) {
$line = fgets($fd1,4096);
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) {
// valid ezmlm thread file entry
 
// On place dans $subjectfile le chemin vers le fichier sujet
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line);
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18);
 
$thread_head = NULL;
$thread_curr = NULL;
$thread_temp = NULL;
$thread_depth = 1;
 
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; }
// on ouvre le fichier sujet
// Celui-ci contient sur la première ligne le hash du sujet puis le sujet
// sur les autres lignes :
// num_message:annéemois:hash_auteur nom_auteur
$fd2 = fopen($this->listdir . "/archive/subjects/" . $subjectfile, "r");
while (!feof($fd2)) {
$line2 = fgets($fd2,4096);
if (preg_match('/^[0-9]/',$line2)) {
$msgnum = preg_replace('/^([0-9]*):.*/', '\\1', $line2);
$msgfile = $msgnum % 100;
$msgdir = (int)($msgnum / 100);
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
//$msg = new ezmlm_parser();
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE);
 
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
 
 
 
// On stocke le fichier analysée pour réutilisation ultàrieure
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ;
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : '');
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
$references = (isset ($mailDecode->headers['references']) ? $mailDecode->headers['references'] : '') ;
$thread_depth = 1;
 
if ($thread_head == NULL) {
$thread_head = new ezmlm_thread(0,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
} else {
$thread_curr = new ezmlm_thread($depth,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
if ($inreply != '') { $thread_curr->inreply = $inreply; }
if ($references != '') { $thread_curr->references = $references; }
$thread_head->append($thread_curr);
}
}
}
fclose($fd2);
 
// so now after all that mess $thread_head contains a full thread tree
// first build the depth of each message based on 'in-reply-to' and 'references'
unset($thread_temp);
$thread_temp = NULL;
$thread_curr =& $thread_head->next;
while (get_class($thread_curr) == 'ezmlm_thread') {
unset($thread_temp);
$thread_temp = NULL;
 
if ($thread_curr->inreply != '') { $thread_temp =& $thread_head->find_msgid($thread_curr->inreply); }
if ($thread_temp == NULL) {
if ($thread_curr->references != '') {
$refs = preg_split('/ /', $thread_curr->references);
$refs = array_pop($refs);
$thread_temp =& $thread_head->find_msgid($refs);
}
}
if ($thread_temp == NULL) {
// we couldn't find anything... set depth to 1, the default
$thread_curr->depth = 1;
} else {
// we found a reference, set it to it's depth + 1
$thread_curr->depth = $thread_temp->depth + 1;
}
$thread_curr =& $thread_curr->next;
}
 
// now write it to a temp file named MONTH-SEQ where seq is cronologic sequence order of the thread.
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
@mkdir($this->tempdir . "/ezmlm-php-" . $this->listname, 0755);
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month, "a");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
fputs($fd2,$this->thread_to_html($thread_head));
fclose($fd2);
}
}
 
// finally store our checksum
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum","w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum","w+");
}
fputs($fd2,"md5:" . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . "\n");
fclose($fd2);
fclose($fd1);
 
return TRUE;
}
 
// listmessages: prints out a nice little calendar and displays the message
// totals for each month. The link jumps to the thread listing.
// On lit le repertoire archive/threads/ qui contient un fichier par mois avec tous les thread, par sujet
// Presentes comme suit
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
// les messages sont ranges par leur numero
function listmessages() {
if (!is_dir($this->listdir . "/archive/threads/")) {
return false ;
}
 
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
$res .=" </tr>\n";
$res .= $this->calendrierMessage();
$res .= "</table>\n";
 
return $res;
/*
$threadcount = array();
 
$repertoire_archive = opendir($this->listdir . "/archive/");
$tableau_annee = array();
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r');
$compteur = 0 ;
 
while (!feof($fichier_index)) {
// On ignore la premiere ligne
$temp = fgets($fichier_index, 4096);
// dans la seconde on recupere la date
$temp = fgets($fichier_index, 4096);
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ;
if ($match[0] != '') {
 
$threadmonth = date('n', strtotime($match[0])) ;
$threadyear = date('Y', strtotime($match[0])) ;
$threadcount[$threadyear][$threadmonth]++;
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
}
}
fclose ($fichier_index);
}
}
if (count($threadcount) == 0) return 'Il n\y a pas de messages dans les archives';
// La partie qui suit, simple, cree la table avec le nombre de message echange chaque mois
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
$res .=" </tr>\n";
arsort($tableau_annee);
foreach ($tableau_annee as $annee) {
$res .= " <tr>\n";
$res .= ' <td class="col_annee">'.$annee.'</td>';
for ($i = 1; $i <= 12; $i++) {
$res .= '<td class="mois">';
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
}
$res .= '</td>';
}
$res .= '</tr>'."\n";
}
$res .= "</table>\n";
return $res ;
*/
}
/*
* Cree un fichier liste.calendrierPermanent qui contient
* le nombre de message par mois pour toutes les annees
* depuis le debut de la liste sauf la derniere
*
*/
function calculeCalendrierPermanent($Annnee = '') {
$numArchive = $this->getNumArchive();
$dernierRepertoire = floor($numArchive / 100);
 
$threadcount = array();
$tableau_annee = array();
 
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
 
// On parcours le fichier a l envers
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
preg_match('/\t([0-9]+) ([a-zA-Z]{3}) ([0-9]{4})/', $fichier_index[$j], $match) ;
if ($match[0] != '') {
$threadmonth = date('n', strtotime($match[0]));
$threadyear = date('Y', strtotime($match[0]));
if ($Annnee != '') {
if ($threadyear < date('Y')) {
$sortir = true;
break;
}
} else {
if ($threadyear == date('Y')) continue;
}
$threadcount[$threadyear][$threadmonth]++;
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
}
}
if ($sortir) break;
}
$res = '';
arsort($tableau_annee);
foreach ($tableau_annee as $annee) {
$res .= " <tr>\n";
$res .= ' <td class="col_annee">'.$annee.'</td>';
for ($i = 1; $i <= 12; $i++) {
$res .= '<td class="mois">';
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
}
$res .= '</td>';
}
$res .= '</tr>'."\n";
}
return $res;
}
function ecrireFichierCalendrier() {
$html = $this->calculeCalendrierPermanent();
$f = fopen ('tmp/'.$this->listname.'.calendrier', 'w') ;
fwrite ($f, $html);
fclose($f);
return $html;
}
 
function calendrierMessage() {
$html = '';
// On ajoute la derniere annee
$html .= $this->calculeCalendrierPermanent(date ('Y'));
 
if (! $this->isFichierCalendrierExiste()) return $html . $this->ecrireFichierCalendrier();
// S'il existe mais qu il est trop vieux, il faut le recalculer et le réécrire
if ($this->isDoitRecalculerCalendrier()) return $html . $this->ecrireFichierCalendrier();
// précédemment, dans ce cas ci-dessus
// était effectuée un recalcul partiel, mais sans réécriture du fichier:
/* $annees = $this->getAnneesARecalculer();
$html .= $this->calculeCalendrierPermanent($annees); */
 
return $html . file_get_contents('tmp/'.$this->listname.'.calendrier');
}
 
function isFichierCalendrierExiste() {
if (file_exists('tmp/'.$this->listname.'.calendrier')) {
return true;
}
return false;
}
function isDoitRecalculerCalendrier() {
return (date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')) <= date('Y') - 1);
}
 
function getAnneesARecalculer() {
// On suppose que l index de ezmlm est correct
$anneeFichierCalendrier = date ('Y', filemtime('tmp/'.$this->listname.'.calendrier'));
return $anneeFichierCalendrier + 1;
}
 
}
 
// CLASS: ezmlm-thread is a quick little class to allow us to define
// a structure of the current thread in a single-linked list.
// it's a little messy since php doesn't support pointers like C does
// so we have to use references and a head object to append to the list.
class ezmlm_thread {
var $next;
var $depth;
var $file;
var $msgid;
var $inreply;
var $references;
function append($thread) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
$thread_curr =& $thread_curr->next;
}
$thread_curr->next = $thread;
}
function &find_msgid($msgid) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
if (trim($thread_curr->msgid) == trim($msgid)) { return $thread_curr; }
$thread_curr =& $thread_curr->next;
}
return NULL;
}
function ezmlm_thread($depth,$file,$msgid) {
$this->depth = $depth;
$this->file = $file;
$this->msgid = $msgid;
$this->next = NULL;
}
}
?>
/trunk/classes/ezmlm-php-2.0/ezmlm-msgdisplay.php
1,400 → 1,396
<?php
// $Id: ezmlm-msgdisplay.php,v 1.9 2008-05-23 10:18:37 alexandre_tb Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
class ezmlm_msgdisplay extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
var $_auth ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
var $msgfile;
function display($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$this->msgfile = $msgfile ;
$message = file_get_contents($msgfile) ;
// En cours de codage
// La fonction display retourne tout simplement le source du mail
// Il n'y a plus d'analyse a ce niveau
return $message;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le delimiteur de l'expression reguliere
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du repertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print $this->parse_entete_mail($mailDecode) ;
$this->parse_template($mailDecode, $a2, $a1);
print $this->message_rendu;
//print '</div>' ;
}
/**
* Renvoie les infos des messages suivants
*
*
*/
function getInfoSuivant() {
$relfile = preg_replace('!' . $this->listdir . '!', '', $this->msgfile);
$nom_repertoire = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile);
$nom_fichier = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile);
$repertoire_suivant = $nom_repertoire;
// On recupere le numero du dernier message
if (file_exists($this->listdir.'/archnum')) {
$numero_dernier_message = file_get_contents($this->listdir.'/archnum');
}
// a partir du nom du fichier
// et du nom du repertoire, on reconstitue
// le numero du message stocke dans le fichier d index
// le message 12 du repertoire 2 a le numero 212
if ($nom_repertoire == '0') {
$numero_message = $nom_fichier;
} else {
$numero_message = $nom_repertoire.$nom_fichier ;
}
// On ouvre le fichier d index
$fichier_index = fopen ($this->listdir.'/archive/'.$nom_repertoire.'/index', 'r');
$compteur_ligne = 1;
if (preg_match ('/0([1-9][0-9]*)/', $nom_fichier, $match)) {
$nom_fichier = $match[1];
$prefixe = '0' ;
} else {
$prefixe = '' ;
}
$prefixe = $this->prefixe_nom_message($nom_fichier);
//echo $numero_message;
// on cherche la ligne avec le numero du message
while (!feof($fichier_index)) {
$temp = fgets($fichier_index,4096);
list($num, $hash, $sujet) = split (':', $temp) ;
if ($num == $numero_message) {
$ligne_message_precedent = $compteur_ligne -2;
$temp = fgets($fichier_index, 4096);
$temp = fgets($fichier_index, 4096);
list ($fichier_suivant,$hash, $sujet) = split(':', $temp);
// Au cas ou est au dernier message du fichier d index
// il faut ouvrir le suivant
if (feof($fichier_index)) {
$repertoire_suivant++;
if (file_exists($this->listdir.'/archive/'.$repertoire_suivant.'/index')) {
$fichier_index_suivant = fopen($this->listdir.'/archive/'.$repertoire_suivant.'/index', 'r');
// on recupere le numero du premier message
list($fichier_suivant, $hash, $sujet) = split (':', fgets($fichier_index_suivant), 4096);
fclose ($fichier_index_suivant);
}
}
// Si le numero est > 100, il faut decouper et ne retenir
// que les dizaines et unites
if ($fichier_suivant >= 100) {
$decimal = (string) $fichier_suivant;
$numero = substr($decimal, -2) ;
$fichier_suivant = $numero ;
} else {
if ($fichier_suivant <= 9)$fichier_suivant = '0'.$fichier_suivant;
}
break;
}
// On avance d une ligne, la 2e ligne contient date hash auteur
$temp2 = fgets($fichier_index, 4096);
$compteur_ligne += 2;
}
// On utilise $ligne_message_precedent pour recupere le num du message precedent
// Si $ligne_precedent est negatif soit c le premier message de la liste
// soit il faut ouvrir le repertoire precedent
if ($ligne_message_precedent > 0) {
$compteur = 1;
rewind($fichier_index);
while (!feof($fichier_index)) {
$temp = fgets($fichier_index, 4096);
if ($ligne_message_precedent == $compteur) {
list ($fichier_precedent, $hash, $sujet) = split (':', $temp) ;
}
$compteur++;
}
// Le nom du repertoire precedent est le meme que le repertoire courant
$repertoire_precedent = $nom_repertoire ;
// Si $ligne_message_precedent est negatif, alors il faut ouvrir
// le fichier index du repertoire precedent
// si le nom du repertoire est 0, alors il n y a pas de repertoire precedent
// et donc pas de message precedent
} else {
if ($nom_repertoire != '0') {
$repertoire_precedent = $nom_repertoire -1 ;
// on ouvre le fichier d index et on extraie le numero
// du dernier message
$fichier_index_precedent = fopen ($this->listdir.'/archive/'.$repertoire_precedent.'/index', 'r') ;
while (!feof($fichier_index_precedent)) {
$temp = fgets($fichier_index_precedent,4096);
$ligne = split (':', $temp) ;
if ($ligne[0] != '') $fichier_precedent = $ligne[0];
$temp = fgets($fichier_index_precedent,4096);
}
fclose ($fichier_index_precedent);
// on se situe dans le repertoire 0 donc pas de message precedent
} else {
$fichier_precedent = null;
$repertoire_precedent = null;
}
}
if ($fichier_precedent > 100) {
$decimal = (string) $fichier_precedent;
$numero = substr($decimal, -2) ;
$fichier_precedent = $numero ;
} else {
if ($fichier_precedent < 10 )$fichier_precedent = '0'.$fichier_precedent;
}
fclose ($fichier_index);
//if ($fichier_precedent != null && $fichier_precedent < 10) $fichier_precedent = '0'.$fichier_precedent;
return array ('fichier_suivant' => $fichier_suivant,
'repertoire_suivant' => $repertoire_suivant,
'fichier_precedent' => $fichier_precedent,
'repertoire_precedent' => $repertoire_precedent);
}
/**
* analyse l'entete d'un mail pour en extraire les ent�tes
* to, from, subject, date
* met � jour la variable $this->msgtmpl
*
*/
function parse_entete_mail (&$mailDecode) {
$startpos = strpos(strtolower($this->msgtmpl_entete), '<ezmlm-headers>');
$endpos = strpos(strtolower($this->msgtmpl_entete), '</ezmlm-headers>');
$headers = substr($this->msgtmpl_entete,$startpos + 15,($endpos - $startpos - 15));
$headers_replace = '' ;
for ($i = 0; $i < count($this->showheaders); $i++) {
$val = $this->showheaders[$i];
$headers_replace .= $headers;
$hnpos = strpos(strtolower($headers_replace), '<ezmlm-header-name>');
$headers_replace = substr_replace($headers_replace, $this->header_en_francais[$val], $hnpos, 19);
$hvpos = strpos(strtolower($headers_replace), '<ezmlm-header-value');
$headers_replace = $this->decode_iso ($headers_replace) ;
switch ($val) {
case 'date':
$headers_replace = substr_replace($headers_replace, $this->date_francaise($mailDecode->headers[strtolower($val)]), $hvpos, 20);
break;
case 'from':
if ($mailDecode->headers[strtolower($val)] == '') $from = $mailDecode->headers['return-path'] ;
else $from = $mailDecode->headers['from'];
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($from)), $hvpos, 20);
//$headers_replace = htmlspecialchars($headers_replace);
break;
default:
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($mailDecode->headers[strtolower($val)])), $hvpos, 20);
}
}
return substr_replace($this->msgtmpl_entete, $headers_replace, $startpos, (($endpos + 16) - $startpos));
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
if ($num_part != '') array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == '8bit') {
$corps .= $this->_cte_8bit($mailDecode->parts[$i]->body);
} else if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == 'quoted-printable') {
if ($mailDecode->parts[$i]->ctype_parameters['charset'] == 'UTF-8') {
$corps .= utf8_decode($mailDecode->parts[$i]->body);
}
}
break;
case 'html' : $corps .= trim(strip_tags ($mailDecode->parts[$i]->body, '<br><p><a><style>'));
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime( $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$lien = PROJET_CHEMIN_APPLI.'fichier_attache.php?nom_liste='.$this->listname.
'&actionargs[]='.$numero_mois.
'&actionargs[]='.$numero_mail;
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
for ($j= 0; $j < count ($profondeur); $j++) $lien .= '&actionargs[]='.$profondeur[$j];
}
$lien .= '&actionargs[]='.$i ;
$corps .= '<a href="'.$lien.'">';
$tableau_type_image = array ('jpg', 'jpeg', 'pjpeg');
if (in_array ($mailDecode->parts[$i]->ctype_secondary, $tableau_type_image)) {
$corps .= '<img src="'.$lien.'&amp;min=1" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$texte_lien = '';
} else {
$corps .= '<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$texte_lien = $nom_piece_jointe;
}
$corps .= $texte_lien;
$corps .= '</a><br />' ;
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime( $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'fichier_attache.php?nom_liste='.$this->listname.'&actionargs[]='.
$numero_mois.'&actionargs[]='.
$numero_mail.'&actionargs[]='.$i.'">'.
'<img src="'.$mimeType->getCheminIcone().'" alt="'.$mailDecode->ctype_parameters['name'].'" />&nbsp;' ;
$corps .= $mailDecode->ctype_parameters['name'].'</a><br />' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body,TRUE), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . utf8_decode($this->cleanup_body($mailDecode->body,TRUE)) . '</pre>', $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . $this->cleanup_body($mailDecode->body,TRUE) . '</pre>', $this->msgtmpl);
}
}
}
array_pop ($profondeur);
}
 
function ezmlm_msgdisplay() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<pre>
<ezmlm-body>
</pre>
';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
// _cte_8bit: decode a content transfer encoding of 8bit
// NOTE: this function is a little bit special. Since the end result will be displayed in
// a web browser _cte_8bit decodes ASCII characters > 127 (the US-ASCII table) into the
// html ordinal equivilant, it also ensures that the messages content-type is changed
// to include text/html if it changes anything...
function _cte_8bit($data,$simple = FALSE) {
if ($simple) { return $data; }
$changed = FALSE;
$out = '';
$chars = preg_split('//',$data);
while (list($key,$val) = each($chars)) {
if (ord($val) > 127) { $out .= '&#' . ord($val) . ';'; $changed = TRUE; }
else { $out .= $val; }
}
if ($changed) { $this->headers['content-type'][1] = 'text/html'; }
return $out;
}
 
}
<?php
// $Id: ezmlm-msgdisplay.php,v 1.11 2008-11-19 09:28:46 aperonnet Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
class ezmlm_msgdisplay extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
var $_auth ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
var $msgfile;
function display($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$this->msgfile = $msgfile ;
$message = file_get_contents($msgfile) ;
// En cours de codage
// La fonction display retourne tout simplement le source du mail
// Il n'y a plus d'analyse a ce niveau
return $message;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le delimiteur de l'expression reguliere
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du repertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print $this->parse_entete_mail($mailDecode) ;
$this->parse_template($mailDecode, $a2, $a1);
print $this->message_rendu;
//print '</div>' ;
}
/**
* Renvoie les infos des messages suivants
*
*
*/
function getInfoSuivant() {
$relfile = preg_replace('!' . $this->listdir . '!', '', $this->msgfile);
$nom_repertoire = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile);
$nom_fichier = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile);
$repertoire_suivant = $nom_repertoire;
// On recupere le numero du dernier message
if (file_exists($this->listdir.'/archnum')) {
$numero_dernier_message = file_get_contents($this->listdir.'/archnum');
}
// a partir du nom du fichier
// et du nom du repertoire, on reconstitue
// le numero du message stocke dans le fichier d index
// le message 12 du repertoire 2 a le numero 212
if ($nom_repertoire == '0') {
$numero_message = $nom_fichier;
} else {
$numero_message = $nom_repertoire.$nom_fichier ;
}
// On ouvre le fichier d index
$fichier_index = fopen ($this->listdir.'/archive/'.$nom_repertoire.'/index', 'r');
$compteur_ligne = 1;
if (preg_match ('/0([1-9][0-9]*)/', $nom_fichier, $match)) {
$nom_fichier = $match[1];
$prefixe = '0' ;
} else {
$prefixe = '' ;
}
$prefixe = $this->prefixe_nom_message($nom_fichier);
//echo $numero_message;
// on cherche la ligne avec le numero du message
while (!feof($fichier_index)) {
$temp = fgets($fichier_index,4096);
$x = preg_match('/(\d+): (\w+) (.*)/', $temp, $matches);
array_shift($matches);
list($num, $hash, $sujet) = $matches;
 
if ($num == $numero_message) {
$ligne_message_precedent = $compteur_ligne -2;
$temp = fgets($fichier_index, 4096);
$temp = fgets($fichier_index, 4096);
list ($fichier_suivant,$hash, $sujet) = split(':', $temp);
// Au cas ou est au dernier message du fichier d index
// il faut ouvrir le suivant
if (feof($fichier_index)) {
$repertoire_suivant++;
if (file_exists($this->listdir.'/archive/'.$repertoire_suivant.'/index')) {
$fichier_index_suivant = fopen($this->listdir.'/archive/'.$repertoire_suivant.'/index', 'r');
// on recupere le numero du premier message
list($fichier_suivant, $hash, $sujet) = split (':', fgets($fichier_index_suivant), 4096);
fclose ($fichier_index_suivant);
}
}
// Si le numero est > 100, il faut decouper et ne retenir
// que les dizaines et unites
if ($fichier_suivant >= 100) {
$decimal = (string) $fichier_suivant;
$numero = substr($decimal, -2) ;
$fichier_suivant = $numero ;
} else {
if ($fichier_suivant <= 9)$fichier_suivant = '0'.$fichier_suivant;
}
break;
}
// On avance d une ligne, la 2e ligne contient date hash auteur
$temp2 = fgets($fichier_index, 4096);
$compteur_ligne += 2;
}
// On utilise $ligne_message_precedent pour recupere le num du message precedent
// Si $ligne_precedent est negatif soit c le premier message de la liste
// soit il faut ouvrir le repertoire precedent
if ($ligne_message_precedent > 0) {
$compteur = 1;
rewind($fichier_index);
while (!feof($fichier_index)) {
$temp = fgets($fichier_index, 4096);
if ($ligne_message_precedent == $compteur) {
list ($fichier_precedent, $hash, $sujet) = split (':', $temp) ;
}
$compteur++;
}
// Le nom du repertoire precedent est le meme que le repertoire courant
$repertoire_precedent = $nom_repertoire ;
// Si $ligne_message_precedent est negatif, alors il faut ouvrir
// le fichier index du repertoire precedent
// si le nom du repertoire est 0, alors il n y a pas de repertoire precedent
// et donc pas de message precedent
} else {
if ($nom_repertoire != '0') {
$repertoire_precedent = $nom_repertoire -1 ;
// on ouvre le fichier d index et on extraie le numero
// du dernier message
$fichier_index_precedent = fopen ($this->listdir.'/archive/'.$repertoire_precedent.'/index', 'r') ;
while (!feof($fichier_index_precedent)) {
$temp = fgets($fichier_index_precedent,4096);
$ligne = split (':', $temp) ;
if ($ligne[0] != '') $fichier_precedent = $ligne[0];
$temp = fgets($fichier_index_precedent,4096);
}
fclose ($fichier_index_precedent);
// on se situe dans le repertoire 0 donc pas de message precedent
} else {
$fichier_precedent = null;
$repertoire_precedent = null;
}
}
if ($fichier_precedent > 100) {
$decimal = (string) $fichier_precedent;
$numero = substr($decimal, -2) ;
$fichier_precedent = $numero ;
} else {
if ($fichier_precedent < 10 )$fichier_precedent = '0'.$fichier_precedent;
}
fclose ($fichier_index);
//if ($fichier_precedent != null && $fichier_precedent < 10) $fichier_precedent = '0'.$fichier_precedent;
return array ('fichier_suivant' => $fichier_suivant,
'repertoire_suivant' => $repertoire_suivant,
'fichier_precedent' => $fichier_precedent,
'repertoire_precedent' => $repertoire_precedent);
}
/**
* analyse l'entete d'un mail pour en extraire les entête
* to, from, subject, date
* met à jour la variable $this->msgtmpl
*
*/
function parse_entete_mail (&$mailDecode) {
$startpos = strpos(strtolower($this->msgtmpl_entete), '<ezmlm-headers>');
$endpos = strpos(strtolower($this->msgtmpl_entete), '</ezmlm-headers>');
$headers = substr($this->msgtmpl_entete,$startpos + 15,($endpos - $startpos - 15));
$headers_replace = '' ;
for ($i = 0; $i < count($this->showheaders); $i++) {
$val = $this->showheaders[$i];
$headers_replace .= $headers;
$hnpos = strpos(strtolower($headers_replace), '<ezmlm-header-name>');
$headers_replace = substr_replace($headers_replace, $this->header_en_francais[$val], $hnpos, 19);
$hvpos = strpos(strtolower($headers_replace), '<ezmlm-header-value');
$headers_replace = $this->decode_iso ($headers_replace) ;
switch ($val) {
case 'date':
$headers_replace = substr_replace($headers_replace, $this->date_francaise($mailDecode->headers[strtolower($val)]), $hvpos, 20);
break;
case 'from':
if ($mailDecode->headers[strtolower($val)] == '') $from = $mailDecode->headers['return-path'] ;
else $from = $mailDecode->headers['from'];
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($from)), $hvpos, 20);
//$headers_replace = htmlspecialchars($headers_replace);
break;
default:
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($mailDecode->headers[strtolower($val)])), $hvpos, 20);
}
}
return substr_replace($this->msgtmpl_entete, $headers_replace, $startpos, (($endpos + 16) - $startpos));
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
if ($num_part != '') array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == '8bit') {
$corps .= $this->_cte_8bit($mailDecode->parts[$i]->body);
} else if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == 'quoted-printable') {
if ($mailDecode->parts[$i]->ctype_parameters['charset'] == 'UTF-8') {
$corps .= utf8_decode($mailDecode->parts[$i]->body);
}
}
break;
case 'html' : $corps .= trim(strip_tags ($mailDecode->parts[$i]->body, '<br><p><a><style>'));
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime( $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$lien = PROJET_CHEMIN_APPLI.'fichier_attache.php?nom_liste='.$this->listname.
'&actionargs[]='.$numero_mois.
'&actionargs[]='.$numero_mail;
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
for ($j= 0; $j < count ($profondeur); $j++) $lien .= '&actionargs[]='.$profondeur[$j];
}
$lien .= '&actionargs[]='.$i ;
$corps .= '<a href="'.$lien.'">';
$corps .= '<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
if ($mailDecode->parts[$i]->ctype_secondary == 'jpg' || $mailDecode->parts[$i]->ctype_secondary == 'jpeg')
$corps .= '<img src="'.$lien.'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime( $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'fichier_attache.php?nom_liste='.$this->listname.'&actionargs[]='.
$numero_mois.'&actionargs[]='.
$numero_mail.'&actionargs[]='.$i.'">'.
'<img src="'.$mimeType->getCheminIcone().'" alt="'.$mailDecode->ctype_parameters['name'].'" />&nbsp;' ;
$corps .= $mailDecode->ctype_parameters['name'].'</a><br />' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body,TRUE), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . utf8_decode($this->cleanup_body($mailDecode->body,TRUE)) . '</pre>', $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . $this->cleanup_body($mailDecode->body,TRUE) . '</pre>', $this->msgtmpl);
}
}
}
array_pop ($profondeur);
}
 
function ezmlm_msgdisplay() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<pre>
<ezmlm-body>
</pre>
';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
// _cte_8bit: decode a content transfer encoding of 8bit
// NOTE: this function is a little bit special. Since the end result will be displayed in
// a web browser _cte_8bit decodes ASCII characters > 127 (the US-ASCII table) into the
// html ordinal equivilant, it also ensures that the messages content-type is changed
// to include text/html if it changes anything...
function _cte_8bit($data,$simple = FALSE) {
if ($simple) { return $data; }
$changed = FALSE;
$out = '';
$chars = preg_split('//',$data);
while (list($key,$val) = each($chars)) {
if (ord($val) > 127) { $out .= '&#' . ord($val) . ';'; $changed = TRUE; }
else { $out .= $val; }
}
if ($changed) { $this->headers['content-type'][1] = 'text/html'; }
return $out;
}
 
}
/trunk/classes/ezmlm-php-2.0/ezmlm-parser.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: ezmlm-parser.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $
// CVS : $Id: ezmlm-parser.php,v 1.5 2008-11-19 09:28:46 aperonnet Exp $
/**
* Application projet
*
29,7 → 29,7
//Auteur original : ?? recupere dans ezmlm-php
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
38,7 → 38,7
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// $Id: ezmlm-parser.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $
// $Id: ezmlm-parser.php,v 1.5 2008-11-19 09:28:46 aperonnet Exp $
//
 
require_once("ezmlm.php");
87,17 → 87,10
$repertoire_archive = opendir($this->listdir . "/archive/");
 
$repertoire_message = array() ;
$dernier_repertoire = 0 ;
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item;
}
}
$numArchive = $this->getNumArchive();
$dernier_repertoire = floor($numArchive / 100);
 
$tableau_message = array() ;
$compteur_message = 0 ;
$fichier_index = fopen ($this->listdir.'/archive/'.$dernier_repertoire.'/index', 'r') ;
176,7 → 169,7
return $this->parse($data,$simple);
}
 
// parse_file_headers - ouvre un fichier et analyse les ent�tes
// parse_file_headers - ouvre un fichier et analyse les entête
function parse_file_headers($file,$simple = FALSE) {
if (!is_file($file)) {
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; }
250,8 → 243,8
}
}
// ajout alex
// pour supprimer le probl�me des ISO...
// a d�placer ailleur, et appel� avant affichage
// pour supprimer le problème des ISO...
// a déplacer ailleur, et appelé avant affichage
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/', $this->headers['subject'], $nombre)) {
$reg_exp = $nombre[0] ;
360,8 → 353,8
function _get_parts($data,$boundary) {
$inpart = -1;
$lines = preg_split('/\n/', $data);
// La premi�re partie contient l'avertissement pour les client mail ne supportant pas
// multipart, elle est stock� dans parts[-1]
// La première partie contient l'avertissement pour les client mail ne supportant pas
// multipart, elle est stocké dans parts[-1]
while(list($key,$val) = each($lines)) {
if ($val == "--" . $boundary) { $inpart++; continue; } // start of a part
else if ($val == "--" . $boundary . "--") { break; } // the end of the last part
368,7 → 361,7
else { $parts[$inpart] .= $val . "\n"; }
}
for ($i = 0; $i < count($parts) - 1; $i++) { // On saute la premi�re partie
for ($i = 0; $i < count($parts) - 1; $i++) { // On saute la première partie
$part[$i] = new ezmlm_parser();
$part[$i]->parse($parts[$i]);
$this->parts[$i] = $part[$i];
/trunk/classes/HTML_formulaireProjet.class.php
1,175 → 1,175
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireProjet.class.php,v 1.7 2007-11-21 09:42:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireProjet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
 
/**
* class HTML_formulaireProjet
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireProjet extends HTML_QuickForm
{
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire(&$tableau_projet, $tableau_type = '', $tableau_theme = '')
{
$this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255, 'size' => '80')) ;
$this->addRule ('projet_titre', PROJET_ALERTE_TITRE, 'required', '', 'client') ;
if ($tableau_type != '') {
$select = new HTML_QuickForm_select ('projet_type', PROJET_TYPE, $tableau_type, array ('class' => 'projet_type')) ;
$this->addElement($select) ;
unset ($select) ;
}
/* impossible de faire fonctionner dojo Editor !!!
*
GEN_stockerStyleExterne('tundra', 'api/js/dojo1.0/dijit/themes/tundra/tundra.css');
GEN_stockerStyleExterne('dojo', 'api/js/dojo1.0/dojo/resources/dojo.css');
GEN_AttributsBody('class', 'tundra');
GEN_stockerFichierScript('dojo', 'api/js/dojo1.0/dojo/dojo.js',
'text/javascript',
array ('djConfig' => 'parseOnLoad: true, isDebug: true'));
GEN_stockerFichierScript('dojo.editor', 'api/js/dojo1.0/dijit/Editor.js', 'text/javascript');
GEN_stockerCodeScript('dojo.config.allowXdRichTextSave = true;');
*/
$this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"5", 'cols'=>'80',
'width'=>"200", /*'dojoType' => 'dijit.Editor',*/ 'id' => 'resume_editeur')) ;
 
$this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION,
array('class'=>"projet_resume", 'rows'=>"20", 'cols'=>'80'/*, 'dojoType' => 'dijit.Editor'*/)) ;
 
$this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet', 'size' => '80')) ;
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne
 
$radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '0', PROJET_NON_MODERE, '0') ;
$radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '1', PROJET_MODERE, '1');
$this->addGroup($radio, null, PROJET_INSCRIPTION, '&nbsp;');
/** Theme du projet ajout 05/2008 */
//var_dump ($tableau_theme);
if ($tableau_theme != '') {
foreach ($tableau_theme as $cle => $theme) {
$checkbox[$cle] = new HTML_QuickForm_checkbox('projet_theme['.$cle.']', '', $theme);
$this->addElement($checkbox[$cle]);
}
}
$label_projet = array() ;
$id_projet = array() ;
foreach ($tableau_projet as $projet) {
$label_projet[] = $projet->getTitre() ;
$id_projet[] = $projet->getId() ;
}
if (PROJET_UTILISE_HIERARCHIE) {
$select = new HTML_QuickForm_select ('projet_asso', PROJET_PERE, $label_projet, array ('class' => 'projet_asso')) ;
$this->addElement($select) ;
unset ($select) ;
}
$this->applyFilter(array('projet_resume', 'projet_description'), 'addslashes') ;
 
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER);
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireProjet.class.php,v 1.8 2008-08-25 15:15:09 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireProjet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
 
/**
* class HTML_formulaireProjet
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireProjet extends HTML_QuickForm
{
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire(&$tableau_projet, $tableau_type = '', $tableau_theme = '')
{
$this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255, 'size' => '80')) ;
$this->addRule ('projet_titre', PROJET_ALERTE_TITRE, 'required', '', 'client') ;
if ($tableau_type != '') {
$select = new HTML_QuickForm_select ('projet_type', PROJET_TYPE, $tableau_type, array ('class' => 'projet_type')) ;
$this->addElement($select) ;
unset ($select) ;
}
/* impossible de faire fonctionner dojo Editor !!!
*
GEN_stockerStyleExterne('tundra', 'api/js/dojo1.0/dijit/themes/tundra/tundra.css');
GEN_stockerStyleExterne('dojo', 'api/js/dojo1.0/dojo/resources/dojo.css');
GEN_AttributsBody('class', 'tundra');
GEN_stockerFichierScript('dojo', 'api/js/dojo1.0/dojo/dojo.js',
'text/javascript',
array ('djConfig' => 'parseOnLoad: true, isDebug: true'));
GEN_stockerFichierScript('dojo.editor', 'api/js/dojo1.0/dijit/Editor.js', 'text/javascript');
GEN_stockerCodeScript('dojo.config.allowXdRichTextSave = true;');
*/
$this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"5", 'cols'=>'80',
'width'=>"200", /*'dojoType' => 'dijit.Editor',*/ 'id' => 'resume_editeur')) ;
 
$this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION,
array('class'=>"projet_resume", 'rows'=>"20", 'cols'=>'80'/*, 'dojoType' => 'dijit.Editor'*/)) ;
 
$this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet', 'size' => '80')) ;
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne
 
$radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '0', PROJET_NON_MODERE, '0') ;
$radio[] = & HTML_QuickForm::createElement('radio', 'projet_moderation', '1', PROJET_MODERE, '1');
$this->addGroup($radio, null, PROJET_INSCRIPTION, '&nbsp;');
/** Theme du projet ajout 05/2008 */
//var_dump ($tableau_theme);
if ($tableau_theme != '') {
foreach ($tableau_theme as $cle => $theme) {
$checkbox[$cle] = new HTML_QuickForm_checkbox('projet_theme['.$cle.']', '', $theme);
$this->addElement($checkbox[$cle]);
}
}
$label_projet = array() ;
$id_projet = array() ;
foreach ($tableau_projet as $projet) {
$label_projet[] = $projet->getTitre() ;
$id_projet[] = $projet->getId() ;
}
if (PROJET_UTILISE_HIERARCHIE) {
$select = new HTML_QuickForm_select ('projet_asso', PROJET_PERE, $label_projet, array ('class' => 'projet_asso')) ;
$this->addElement($select) ;
unset ($select) ;
}
$this->applyFilter(array('projet_resume', 'projet_description'), 'addslashes') ;
 
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER);
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/classes/participe.class.php
1,425 → 1,426
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participe.class.php,v 1.6 2008-08-25 15:11:56 alexandre_tb Exp $
/**
* Application projet
*
* La classe partiicpe assure la jointure entre projet et Auth
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class participe
*
*/
class participe
{
/*** Attributes: ***/
 
/**
* Date d'inscription au projet de l'utilisateur.
* @access private
*/
var $_date_inscription;
/**
* Statut de l'utilisateur, un entier.
* @access private
*/
var $_statut;
/**
* Connexion à la base de donnée.
* @access private
*/
var $_db;
 
/**
* Constructeur. Nécessite un objet DB valide connecté à la base contenant les
* tables projets.
*
* @param DB objetDB Un objet PEAR:DB valide.
* @return void
* @access public
*/
function participe( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function participe
 
/**
* Renvoie la liste des inscrit à un projet avec leur statut.
*
* @return Array
* @access public
*/
function getInscrits($id_projet, $droits )
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
$id = $ligne[0];
$inscrits[$id]['nom'] = $ligne[1];
$inscrits[$id]['prenom'] = $ligne[2];
$inscrits[$id]['mail'] = $ligne[3];
$inscrits[$id]['date'] = $ligne[4];
$inscrits[$id]['id_statut'] = $ligne[5];
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInscrits
 
/**
* Renvoie un tableau contenant la liste des identifiants des projets et des statuts
* d'un inscrit. 0 => ['psu_id_utilisateur'] ['psu_id_statut'] 1 => ...
*
* @param int id_utilisateur Un identifiant d'utilisateur pour le champs
* projet_statut_utilisateurs:psu_id_utilisateur
* @return Array
* @access public
*/
function getIdProjetsStatuts( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select psu_id_utilisateur, psu_id_statut from projet_statut_utilisateurs".
" where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getIdProjetsStatuts
 
 
/**
* Renvoie un tableau à 2 dimensions avec les informations sur l'inscription aux
* différents projets d'un utilisateur. 0 => ['p_titre'] Le titre du projet
* ['ps_label'] Le statut de l'utilisateur 1 => .... (autant que de
* projets)
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @return Array
* @access public
*/
function getInformationsUtilisateurs( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select p_titre, ps_statut_nom, psu_id_statut, psu_id_projet from projet_statut_utilisateurs, projet, projet_statut".
" where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur).
" and psu_id_projet = p_id and psu_id_statut = ps_id_statut" ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow()) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInformationsUtilisateurs
 
 
/**
* Renvoie le statut du projet passé en paramètre.
*
* @param int id_utilisateur
* @param int id_projet
* @param int dbObject
* @return int
* @static
* @access public
*/
function getStatutSurProjetCourant( $id_utilisateur, $id_projet, &$dbObject )
{
if (participe::isAdministrateur($id_utilisateur, $dbObject)) return PROJET_DROIT_ADMINISTRATEUR;
$requete = 'select psu_id_statut from projet_statut_utilisateurs'.
' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet ='.$this->_db->escapeSimple($id_projet) ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError ($resultat)) {
return DB::raiseError('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if (!$resultat->numRows()) {
return 4 ; // Le statut ne participe pas
}
return $ligne->psu_id_statut ;
} // end of member function getStatutSurProjetCourant
 
/**
* Réalise une requête dans projet_statut_utilisateurs et renvoie true si l'utilisateur
* est administrateur de l'application projet.
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @access public
*/
function isAdministrateur( $id_utilisateur, $objetDB = "" )
{
// La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
// pour indiquer un administrateur
$requete = "select psu_id_statut from projet_statut_utilisateurs where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur)." ".
" and psu_id_projet=0" ;
if (is_object ($objetDB)) {
$resultat = $objetDB->query ($requete) ;
} else {
$resultat = $this->_db->query ($requete) ;
}
if ($resultat->numRows () != 0) {
return true;
}
return false ;
} // end of member function isAdministrateur
 
/**
* Met à jour le statut d'un utilisateur sur un projet
*
* @param int id_statut L'identifiant du statut à ajouter ou mettre à jour
* @param int id_utilisateur Identifiant de l'utilisateur
* @param int id_projet Identifiant du projet
* @return bool
* @access public
*/
function setStatut( $id_statut, $id_utilisateur, $id_projet )
{
$requete = 'update projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
' where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$this->_db->escapeSimple($id_projet);
if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
$requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
', psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).',psu_id_projet='.$this->_db->escapeSimple($id_projet).
', psu_date_inscription=NOW()';
}
if ($id_statut == 4) { // Si le statut est ne participe pas, on supprime l'inscrit
$requete = 'delete from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet='.$this->_db->escapeSimple($id_projet) ;
}
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function setStatut
 
/**
* Renvoie vrai si l'utilisateur est coordinateur, faux dans les autres cas
*
* @param int id_utilisateur L'identifiant d'un utilisateur
* @param DB objetDB Optionnel, nécessaire si on appelle cette méthode statiquement
* @return bool
* @static
* @access public
*/
function isCoordinateur( $id_utilisateur, $id_projet, &$objetDB )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) ;
if ($statut == 1) {
return true;
}
return false ;
} // end of member function isCoordinateur
 
/**
* Renvoie la liste des projets auquels l'utilisateur passé en paramètre ne
* participe pas.
*
* @param int id_utilisateur L'identifiant de l'utilisateur.
* @return Array
* @access public
*/
function getProjetsNonParticipant( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = 'select p_id from projet'.
' where p_id not in (select psu_id_projet from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).')' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($this->_db, $ligne->p_id)) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getProjetsNonParticipant
 
/**
* Renvoie true si l'utilisateur passé en paramètre est observateur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isObservateur( $id_utilisateur, $id_projet, &$objetDB )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isContributeur( $id_utilisateur, $id_projet, &$objetDB )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 4) return false;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 2) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isEnAttente( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie les infos sur les coordinateurs d'un projet
*
* @param int id_projet L'identifiant du projet
* @return array Un tableau contenant les infos concernants les coordinateurs du projet
* @access public
*/
function getCoordinateurs($id_projet)
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=1 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getCoordinateurs
function getAdministrateurs () {
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=0 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
}
/**
* Renvoie la constante de statut d un utilisateur
*
* define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
* define ('PROJET_DROIT_COORDINATEUR', 2) ;
* define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
* define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
* define ('PROJET_DROIT_AUCUN', 16) ;
* define ('PROJET_DROIT_EN_ATTENTE', 32);
*
* @access public
* @return int La constante de statut
*/
function getStatut($id_utilisateur, $id_projet)
{
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db);
switch ($statut)
{
case 0 : return PROJET_DROIT_ADMINISTRATEUR;
break;
case 1 : return PROJET_DROIT_COORDINATEUR;
break;
case 2 : return PROJET_DROIT_CONTRIBUTEUR;
break;
case 3 : return PROJET_DROIT_EN_ATTENTE;
break;
default : return PROJET_DROIT_AUCUN;
}
}
} // end of participe
?>
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participe.class.php,v 1.7 2008-09-16 14:11:31 alexandre_tb Exp $
/**
* Application projet
*
* La classe partiicpe assure la jointure entre projet et Auth
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class participe
*
*/
class participe
{
/*** Attributes: ***/
 
/**
* Date d'inscription au projet de l'utilisateur.
* @access private
*/
var $_date_inscription;
/**
* Statut de l'utilisateur, un entier.
* @access private
*/
var $_statut;
/**
* Connexion à la base de donnée.
* @access private
*/
var $_db;
 
/**
* Constructeur. Nécessite un objet DB valide connecté à la base contenant les
* tables projets.
*
* @param DB objetDB Un objet PEAR:DB valide.
* @return void
* @access public
*/
function participe( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function participe
 
/**
* Renvoie la liste des inscrit à un projet avec leur statut.
*
* @return Array
* @access public
*/
function getInscrits($id_projet, $droits )
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
$id = $ligne[0];
$inscrits[$id]['nom'] = $ligne[1];
$inscrits[$id]['prenom'] = $ligne[2];
$inscrits[$id]['mail'] = $ligne[3];
$inscrits[$id]['date'] = $ligne[4];
$inscrits[$id]['id_statut'] = $ligne[5];
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInscrits
 
/**
* Renvoie un tableau contenant la liste des identifiants des projets et des statuts
* d'un inscrit. 0 => ['psu_id_utilisateur'] ['psu_id_statut'] 1 => ...
*
* @param int id_utilisateur Un identifiant d'utilisateur pour le champs
* projet_statut_utilisateurs:psu_id_utilisateur
* @return Array
* @access public
*/
function getIdProjetsStatuts( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select psu_id_utilisateur, psu_id_statut from projet_statut_utilisateurs".
" where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getIdProjetsStatuts
 
 
/**
* Renvoie un tableau à 2 dimensions avec les informations sur l'inscription aux
* différents projets d'un utilisateur. 0 => ['p_titre'] Le titre du projet
* ['ps_label'] Le statut de l'utilisateur 1 => .... (autant que de
* projets)
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @return Array
* @access public
*/
function getInformationsUtilisateurs( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select p_titre, ps_statut_nom, psu_id_statut, psu_id_projet from projet_statut_utilisateurs, projet, projet_statut".
" where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur).
" and psu_id_projet = p_id and psu_id_statut = ps_id_statut" ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow()) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInformationsUtilisateurs
 
 
/**
* Renvoie le statut du projet passé en paramètre.
*
* @param int id_utilisateur
* @param int id_projet
* @param int dbObject
* @return int
* @static
* @access public
*/
function getStatutSurProjetCourant( $id_utilisateur, $id_projet, &$dbObject )
{
if (participe::isAdministrateur($id_utilisateur, $dbObject)) return PROJET_DROIT_ADMINISTRATEUR;
$requete = 'select psu_id_statut from projet_statut_utilisateurs'.
' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet ='.$this->_db->escapeSimple($id_projet) ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError ($resultat)) {
return DB::raiseError('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if (!$resultat->numRows()) {
return 4 ; // Le statut ne participe pas
}
return $ligne->psu_id_statut ;
} // end of member function getStatutSurProjetCourant
 
/**
* Réalise une requête dans projet_statut_utilisateurs et renvoie true si l'utilisateur
* est administrateur de l'application projet.
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @access public
*/
function isAdministrateur( $id_utilisateur, $objetDB = "" )
{
// La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
// pour indiquer un administrateur
$requete = "select psu_id_statut from projet_statut_utilisateurs where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur)." ".
" and psu_id_projet=0" ;
if (is_object ($objetDB)) {
$resultat = $objetDB->query ($requete) ;
} else {
$resultat = $this->_db->query ($requete) ;
}
if ($resultat->numRows () != 0) {
return true;
}
return false ;
} // end of member function isAdministrateur
 
/**
* Met à jour le statut d'un utilisateur sur un projet
*
* @param int id_statut L'identifiant du statut à ajouter ou mettre à jour
* @param int id_utilisateur Identifiant de l'utilisateur
* @param int id_projet Identifiant du projet
* @return bool
* @access public
*/
function setStatut( $id_statut, $id_utilisateur, $id_projet )
{
$requete = 'update projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet='.$this->_db->escapeSimple($id_projet);
if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
$requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
', psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).',psu_id_projet='.$this->_db->escapeSimple($id_projet).
', psu_date_inscription=NOW()';
}
if ($id_statut == 4) { // Si le statut est ne participe pas, on supprime l'inscrit
$requete = 'delete from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).
' and psu_id_projet='.$this->_db->escapeSimple($id_projet) ;
}
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function setStatut
 
/**
* Renvoie vrai si l'utilisateur est coordinateur, faux dans les autres cas
*
* @param int id_utilisateur L'identifiant d'un utilisateur
* @param DB objetDB Optionnel, nécessaire si on appelle cette méthode statiquement
* @return bool
* @static
* @access public
*/
function isCoordinateur( $id_utilisateur, $id_projet, &$objetDB )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) ;
if ($statut == 1) {
return true;
}
return false ;
} // end of member function isCoordinateur
 
/**
* Renvoie la liste des projets auquels l'utilisateur passé en paramètre ne
* participe pas.
*
* @param int id_utilisateur L'identifiant de l'utilisateur.
* @return Array
* @access public
*/
function getProjetsNonParticipant( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = 'select p_id from projet'.
' where p_id not in (select psu_id_projet from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).')' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($this->_db, $ligne->p_id)) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getProjetsNonParticipant
 
/**
* Renvoie true si l'utilisateur passé en paramètre est observateur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isObservateur( $id_utilisateur, $id_projet, &$objetDB )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isContributeur( $id_utilisateur, $id_projet, &$objetDB )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 4) return false;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 2) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isEnAttente( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie les infos sur les coordinateurs d'un projet
*
* @param int id_projet L'identifiant du projet
* @return array Un tableau contenant les infos concernants les coordinateurs du projet
* @access public
*/
function getCoordinateurs($id_projet)
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=1 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getCoordinateurs
function getAdministrateurs () {
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=0 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
}
/**
* Renvoie la constante de statut d un utilisateur
*
* define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
* define ('PROJET_DROIT_COORDINATEUR', 2) ;
* define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
* define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
* define ('PROJET_DROIT_AUCUN', 16) ;
* define ('PROJET_DROIT_EN_ATTENTE', 32);
*
* @access public
* @return int La constante de statut
*/
function getStatut($id_utilisateur, $id_projet)
{
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db);
switch ($statut)
{
case 0 : return PROJET_DROIT_ADMINISTRATEUR;
break;
case 1 : return PROJET_DROIT_COORDINATEUR;
break;
case 2 : return PROJET_DROIT_CONTRIBUTEUR;
break;
case 3 : return PROJET_DROIT_EN_ATTENTE;
break;
default : return PROJET_DROIT_AUCUN;
}
}
} // end of participe
?>
/trunk/classes/type_fichier_mime.class.php
1,190 → 1,190
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: type_fichier_mime.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe type_fichier_mime
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class type_fichier_mime
*
*/
class type_fichier_mime
{
/*** Attributes: ***/
 
/**
* Le nom du type en français (ex Image jpg)
* @access private
*/
var $_nom;
/**
* L'extension du fichier (ex: png)
* @access private
*/
var $_extension;
/**
* Le nom du fichier de l'icône représentant ce fichier.
* @access private
*/
var $_icone;
/**
* Le type mime.
* @access private
*/
var $_type_mime;
/**
*
* @access private
*/
var $_description;
/**
* Le chemin UNIX ou Windows vers le dossier des icônes. Il ne commence pas par un
* slash et termine par slash.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du type dans la table gen_type_de_fichier
* @access private
*/
var $_id_type;
 
/**
* Renvoie le chemin vers les icônes.
*
* @return string
* @access public
*/
function getCheminIcone( )
{
return $this->_chemin_icone.$this->_icone ; ;
} // end of member function getCheminIcone
 
/**
*
*
* @param string chemin Le chemin vers l'icône.
* @return void
* @access public
*/
function setCheminIcone( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcone
 
/**
*
*
* @param DB objetDB un objet PEAR:DB
* @param int id_type
* @return void
* @access public
*/
function type_fichier_mime( $id_type = '', $chemin_icones = "icones/" )
{
$requete = 'select * from gen_type_de_fichier where ' ;
if (is_numeric ($id_type)) {
$requete .= 'gtf_id_type='.$GLOBALS['projet_db']->escapeSimple($id_type) ;
} else {
$requete .= 'gtf_type_mime="'.$id_type.'"' ;
}
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_chemin_icone = $chemin_icones ;
$this->_icone = $ligne->gtf_type_icone ;
$this->_id_type = $ligne->gtf_id_type ;
} // end of member function type_fichier_mime
 
/**
* Tente de renvoyer un objet type_fichier_mime à partir de l'extension passé en
* paramètre. S'il elle n'y arrive pas, elle renvoie 'inconnue'.
*
* @param string extension On passe un extension en paramètre, pour déterminer le type mime.
* @param DB objetDB un objet PEAR:DB
* @return type_fichier_mime
* @static
* @access public
*/
function factory( $extension, $objetDB = '')
{
if (is_object($objetDB)) {
$GLOBALS['projet_db'] = $objetDB;
}
$requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return new type_fichier_mime ( $ligne->gtf_id_type) ;
} else {
// si il n'y a pas de résultat, on renvoie inconnue
return new type_fichier_mime (12) ;
}
} // end of member function factory
 
/**
* Renvoie l'identifiant du type Mime de la table gen_type_de_fichier
*
* @return int
* @access public
*/
function getIdType( )
{
return $this->_id_type;
} // end of member function getIdType
 
 
} // end of type_fichier_mime
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: type_fichier_mime.class.php,v 1.3 2008-08-25 15:03:52 alexandre_tb Exp $
/**
* Application projet
*
* La classe type_fichier_mime
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class type_fichier_mime
*
*/
class type_fichier_mime
{
/*** Attributes: ***/
 
/**
* Le nom du type en français (ex Image jpg)
* @access private
*/
var $_nom;
/**
* L'extension du fichier (ex: png)
* @access private
*/
var $_extension;
/**
* Le nom du fichier de l'icône représentant ce fichier.
* @access private
*/
var $_icone;
/**
* Le type mime.
* @access private
*/
var $_type_mime;
/**
*
* @access private
*/
var $_description;
/**
* Le chemin UNIX ou Windows vers le dossier des icônes. Il ne commence pas par un
* slash et termine par slash.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du type dans la table gen_type_de_fichier
* @access private
*/
var $_id_type;
 
/**
* Renvoie le chemin vers les icônes.
*
* @return string
* @access public
*/
function getCheminIcone( )
{
return $this->_chemin_icone.$this->_icone ; ;
} // end of member function getCheminIcone
 
/**
*
*
* @param string chemin Le chemin vers l'icône.
* @return void
* @access public
*/
function setCheminIcone( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcone
 
/**
*
*
* @param DB objetDB un objet PEAR:DB
* @param int id_type
* @return void
* @access public
*/
function type_fichier_mime( $id_type = '', $chemin_icones = "icones/" )
{
$requete = 'select * from gen_type_de_fichier where ' ;
if (is_numeric ($id_type)) {
$requete .= 'gtf_id_type='.$GLOBALS['projet_db']->escapeSimple($id_type) ;
} else {
$requete .= 'gtf_type_mime="'.$id_type.'"' ;
}
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_chemin_icone = $chemin_icones ;
$this->_icone = $ligne->gtf_type_icone ;
$this->_id_type = $ligne->gtf_id_type ;
} // end of member function type_fichier_mime
 
/**
* Tente de renvoyer un objet type_fichier_mime à partir de l'extension passé en
* paramètre. S'il elle n'y arrive pas, elle renvoie 'inconnue'.
*
* @param string extension On passe un extension en paramètre, pour déterminer le type mime.
* @param DB objetDB un objet PEAR:DB
* @return type_fichier_mime
* @static
* @access public
*/
function factory( $extension, $objetDB = '')
{
if (is_object($objetDB)) {
$GLOBALS['projet_db'] = $objetDB;
}
$requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return new type_fichier_mime ( $ligne->gtf_id_type) ;
} else {
// si il n'y a pas de résultat, on renvoie inconnue
return new type_fichier_mime (12) ;
}
} // end of member function factory
 
/**
* Renvoie l'identifiant du type Mime de la table gen_type_de_fichier
*
* @return int
* @access public
*/
function getIdType( )
{
return $this->_id_type;
} // end of member function getIdType
 
 
} // end of type_fichier_mime
?>
/trunk/classes/gestion_wikini.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: gestion_wikini.class.php,v 1.2 2005/09/27 16:38:54 alexandre_tb Exp $
// CVS : $Id: gestion_wikini.class.php,v 1.2 2005-09-27 16:38:54 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/liste_discussion.class.php
1,288 → 1,294
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_discussion.class.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* La classe liste_discussion
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
/**
* class liste_discussion
*
*/
class liste_discussion
{
 
/*** Attributes: ***/
 
/**
* Le nom de la liste, sans le domaine.
* @access private
*/
var $_nom;
/**
*
* @access private
*/
var $_adresse;
/**
* Le domaine de la liste
* @access private
*/
var $_domaine;
/**
*
* @access private
*/
var $_adresse_inscription;
/**
*
* @access private
*/
var $_adresse_desinscription;
/**
*
* @access private
*/
var $_adresse_aide;
/**
* Une connexion PEAR::DB
* @access private
*/
var $_db;
/**
* L'identifiant de la liste.
* @access private
*/
var $_id;
/**
*
* @access private
*/
var $_adresse_inscription_resume;
/**
* Indique la portee, publique ou privee de la liste
* @access private
*/
var $_portee;
/**
* Le constructeur
*
* @param int id_liste L'identifiant de la liste souhait�
* @param DB objetDB Un objet PEAR:DB
* @return void
* @access public
*/
function liste_discussion( $id_liste, & $objetDB )
{
$this->_db = $objetDB ;
if ($id_liste != '') {
$this->_id = $id_liste ;
$requete_liste = 'select * from projet_liste where pl_id_liste='.$this->_db->escapeSimple($this->_id) ;
$resultat_liste = $this->_db->query ($requete_liste) ;
if (DB::isError ($resultat_liste)) {
die ("Echec de la requete : $requete_liste<br />".$resultat_liste->getMessage()) ;
}
$ligne_liste = $resultat_liste->fetchRow(DB_FETCHMODE_OBJECT) ;
$this->_adresse = $ligne_liste->pl_adresse_liste ;
$this->_domaine = $ligne_liste->pl_domaine ;
$this->_nom = $ligne_liste->pl_nom_liste ;
$this->_adresse_inscription = $ligne_liste->pl_adresse_inscription ;
$this->_adresse_inscription_resume = $ligne_liste->pl_nom_liste.'-digest-subscribe@'.$this->_domaine ;
$this->_portee = $ligne_liste->pl_visibilite ;
}
} // end of member function liste_discussion
 
 
/**
* Renvoie le domaine de la liste
*
* @return string
* @access public
*/
function getDomaine( )
{
return $this->_domaine ;
} // end of member function getDomaine
 
/**
* Renvoie le nom de la liste
*
* @return string
* @access public
*/
function getNom( )
{
return $this->_nom ;
} // end of member function getNom
 
/**
* Renvoie l'identifiant de la liste
*
* @return integer
* @access public
*/
function getId( )
{
return $this->_id ;
} // end of member function getNom
 
 
function getVisibilite( )
{
return $this->_portee ;
} // end of member function getNom
 
/**
* Enregistre une ligne dans la table projet_liste
* Le tableau de valeur doit contenir les �l�ments suivants 'nom_liste','','domaine_liste'
*
* @param Array tableau_de_valeur Le tableau de valeur a ins�rer dans la base avec pour cl� les noms des �l�ments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur) {
$id = SQL_obtenirNouveauId($this->_db, 'projet_liste', 'pl_id_liste') ;
 
$requete = "insert into projet_liste set pl_id_liste=".$this->_db->escapeSimple($id) ;
$requete .= ", pl_nom_liste=\"".$valeur['nom_liste']."\", pl_domaine=\"".$valeur['domaine_liste']."\"".
", pl_adresse_liste=\"".$valeur['nom_liste'].'@'.$valeur['domaine_liste'].'", pl_adresse_inscription="'.
$valeur['nom_liste']."-subscribe@".$valeur['domaine_liste'].'",pl_adresse_desinscription="'.
$valeur['nom_liste']."-unsubscribe@".$valeur['domaine_liste'].'", pl_adresse_aide="'.
$valeur['nom_liste']."-help@".$valeur['domaine_liste'].'", pl_visibilite="'.$valeur['liste_visibilite'].'"' ;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
$this->_domaine = $valeur['domaine_liste'] ;
$this->_nom = $valeur['nom_liste'] ;
return $id;
}
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$requete = "delete from projet_liste where pl_id_liste=".$this->_db->escapeSimple($this->_id);
$resultat = $this->_db->query ($requete) ;
 
return true ;
} // end of member function suppressionSQL
 
/**
* V�rifie si une liste existe d�j� dans la table projet_liste.
*
* @param string adresse_liste L'adresse de la liste � tester
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @static
* @access public
*/
function verifieDoubleListe( $adresse_liste, &$objetDB )
{
$requete = 'select pl_id_liste from projet_liste where pl_adresse_liste="'.$adresse_liste.'"' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows()) {
return false;
}
return true ;
} // end of member function verifieDoubleListe
 
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseEnvoi( )
{
return $this->_adresse ;
} // end of member function getAdresseEnvoi
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseInscription( )
{
return $this->_adresse_inscription ;
} // end of member function getAdresseEnvoi
 
/**
*
*
* @return string
* @access public
*/
function getAdresseResume( )
{
return $this->_adresse_inscription_resume ;
} // end of member function getAdresseResume
 
 
/**
*
*
* @return string
* @access public
*/
function isPublic( )
{
return $this->_portee ;
} // end of member function getAdresseResume
} // end of liste_discussion
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_discussion.class.php,v 1.4 2008-08-25 15:12:24 alexandre_tb Exp $
/**
* Application projet
*
* La classe liste_discussion
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
/**
* class liste_discussion
*
*/
class liste_discussion
{
 
/*** Attributes: ***/
 
 
/**
* Le nom de la liste, sans le domaine.
* @access private
*/
var $_nom;
/**
*
* @access private
*/
var $_adresse;
/**
* Le domaine de la liste
* @access private
*/
var $_domaine;
/**
*
* @access private
*/
var $_adresse_inscription;
/**
*
* @access private
*/
var $_adresse_desinscription;
/**
*
* @access private
*/
var $_adresse_aide;
/**
* Une connexion PEAR::DB
* @access private
*/
var $_db;
/**
* L'identifiant de la liste.
* @access private
*/
var $_id;
/**
*
* @access private
*/
var $_adresse_inscription_resume;
/**
* Indique la portee, publique ou privee de la liste
* @access private
*/
var $_portee;
 
/**
* Le constructeur
*
* @param int id_liste L'identifiant de la liste souhaité
* @param DB objetDB Un objet PEAR:DB
* @return void
* @access public
*/
function liste_discussion( $id_liste, & $objetDB )
{
$this->_db = $objetDB ;
if ($id_liste != '') {
$this->_id = $id_liste ;
 
$requete_liste = 'select * from projet_liste where pl_id_liste='.$this->_db->escapeSimple($this->_id) ;
$resultat_liste = $this->_db->query ($requete_liste) ;
if (DB::isError ($resultat_liste)) {
die ("Echec de la requete : $requete_liste<br />".$resultat_liste->getMessage()) ;
}
$ligne_liste = $resultat_liste->fetchRow(DB_FETCHMODE_OBJECT) ;
$this->_adresse = $ligne_liste->pl_adresse_liste ;
$this->_domaine = $ligne_liste->pl_domaine ;
$this->_nom = $ligne_liste->pl_nom_liste ;
$this->_adresse_inscription = $ligne_liste->pl_adresse_inscription ;
$this->_adresse_inscription_resume = $ligne_liste->pl_nom_liste.'-digest-subscribe@'.$this->_domaine ;
$this->_portee = $ligne_liste->pl_visibilite ;
}
} // end of member function liste_discussion
 
 
/**
* Renvoie le domaine de la liste
*
* @return string
* @access public
*/
function getDomaine( )
{
return $this->_domaine ;
} // end of member function getDomaine
 
/**
* Renvoie le nom de la liste
*
* @return string
* @access public
*/
function getNom( )
{
return $this->_nom ;
} // end of member function getNom
 
/**
* Renvoie l'identifiant de la liste
*
* @return integer
* @access public
*/
function getId( )
{
return $this->_id ;
} // end of member function getNom
 
function getVisibilite( )
{
return $this->_portee ;
} // end of member function getNom
 
/**
* Enregistre une ligne dans la table projet_liste
* Le tableau de valeur doit contenir les éléments suivants 'nom_liste','','domaine_liste'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur) {
 
$id = SQL_obtenirNouveauId($this->_db, 'projet_liste', 'pl_id_liste') ;
 
$requete = "insert into projet_liste set pl_id_liste=".$this->_db->escapeSimple($id) ;
$requete .= ", pl_nom_liste=\"".$valeur['nom_liste']."\", pl_domaine=\"".$valeur['domaine_liste']."\"".
", pl_adresse_liste=\"".$valeur['nom_liste'].'@'.$valeur['domaine_liste'].'", pl_adresse_inscription="'.
$valeur['nom_liste']."-subscribe@".$valeur['domaine_liste'].'",pl_adresse_desinscription="'.
$valeur['nom_liste']."-unsubscribe@".$valeur['domaine_liste'].'", pl_adresse_aide="'.
$valeur['nom_liste']."-help@".$valeur['domaine_liste'].'", pl_visibilite="'.$valeur['liste_visibilite'].'"' ;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
$this->_domaine = $valeur['domaine_liste'] ;
$this->_nom = $valeur['nom_liste'] ;
return $id;
}
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
 
$requete = "delete from projet_liste where pl_id_liste=".$this->_db->escapeSimple($this->_id) ;
$resultat = $this->_db->query ($requete) ;
 
return true ;
} // end of member function suppressionSQL
 
/**
* Vérifie si une liste existe déjà dans la table projet_liste.
*
* @param string adresse_liste L'adresse de la liste à tester
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @static
* @access public
*/
function verifieDoubleListe( $adresse_liste, &$objetDB )
{
$requete = 'select pl_id_liste from projet_liste where pl_adresse_liste="'.$adresse_liste.'"' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows()) {
return false;
}
return true ;
} // end of member function verifieDoubleListe
 
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseEnvoi( )
{
return $this->_adresse ;
} // end of member function getAdresseEnvoi
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseInscription( )
{
return $this->_adresse_inscription ;
} // end of member function getAdresseEnvoi
 
/**
*
*
* @return string
* @access public
*/
function getAdresseResume( )
{
return $this->_adresse_inscription_resume ;
} // end of member function getAdresseResume
 
 
/**
*
*
* @return string
* @access public
*/
function isPublic( )
{
return $this->_portee ;
} // end of member function getAdresseResume
 
 
 
 
 
 
 
} // end of liste_discussion
?>
/trunk/classes/statut.class.php
1,138 → 1,138
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: statut.class.php,v 1.2 2005/09/27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe statut
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
define ('PROJET_STATUT_TOUS', 1) ;
define ('PROJET_STATUT_SAUF_ADM', 2) ;
define ('PROJET_STATUT_SAUF_ADM_COORD', 3) ;
 
/**
* class statut
*
*/
class statut
{
 
/** Aggregations: */
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du statut
* @access private
*/
var $_id_statut;
/**
* Le label du statut, dans la table.
* @access private
*/
var $_label;
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur.
*
* @param int id_statut L'identifiant du statut créé.
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function statut( $id_statut, &$objetDB )
{
$requete = "select * from projet_statut where ps_id_statut=".$objetDB->escapeSimple($id_statut)." " ;
$resultat = $objetDB->query ($requete) ;
if (PEAR::isError ($resultat)) {
die ($resultat->getMessage()."<br />".$requete."<br />") ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_db = $objetDB ;
$this->_id_statut = $ligne->pd_id_statut ;
$this->_label = $ligne->ps_statut_nom;
} // end of member function statut
 
/**
* Renvoie le label du statut.
*
* @return string
* @access public
*/
function getLabel( )
{
return $this->_label ;
} // end of member function getLabel
/**
*
*
* @param int type_statut Indique quels statuts l'on désire voir retourner PROJET_STATUT_TOUS
* PROJET_STATUT_SAUF_ADM PROJET_STATUT_SAUF_ADM_COORD
* @return Array
* @static
* @access public
*/
function getTousLesStatuts( $type_statut = PROJET_STATUT_TOUS, &$objetDB)
{
$requete = 'select * from projet_statut' ;
if ($type_statut == PROJET_STATUT_SAUF_ADM) {
$requete .= ' where ps_id_statut <> 0' ;
}
if ($type_statut == PROJET_STATUT_SAUF_ADM_COORD) {
$requete .= ' where ps_id_statut > 1' ;
}
$resultat = $objetDB->query ($requete) ;
$tableau_resultat = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->ps_id_statut] = $ligne->ps_statut_nom ;
}
return $tableau_resultat;
} // end of member function getTousLesStatuts
 
 
 
 
 
} // end of statut
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: statut.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe statut
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
define ('PROJET_STATUT_TOUS', 1) ;
define ('PROJET_STATUT_SAUF_ADM', 2) ;
define ('PROJET_STATUT_SAUF_ADM_COORD', 3) ;
 
/**
* class statut
*
*/
class statut
{
 
/** Aggregations: */
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du statut
* @access private
*/
var $_id_statut;
/**
* Le label du statut, dans la table.
* @access private
*/
var $_label;
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur.
*
* @param int id_statut L'identifiant du statut créé.
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function statut( $id_statut, &$objetDB )
{
$requete = "select * from projet_statut where ps_id_statut=".$this->_db->escapeSimple($id_statut)." " ;
$resultat = $objetDB->query ($requete) ;
if (PEAR::isError ($resultat)) {
die ($resultat->getMessage()."<br />".$requete."<br />") ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_db = $objetDB ;
$this->_id_statut = $ligne->pd_id_statut ;
$this->_label = $ligne->ps_statut_nom;
} // end of member function statut
 
/**
* Renvoie le label du statut.
*
* @return string
* @access public
*/
function getLabel( )
{
return $this->_label ;
} // end of member function getLabel
/**
*
*
* @param int type_statut Indique quels statuts l'on désire voir retourner PROJET_STATUT_TOUS
* PROJET_STATUT_SAUF_ADM PROJET_STATUT_SAUF_ADM_COORD
* @return Array
* @static
* @access public
*/
function getTousLesStatuts( $type_statut = PROJET_STATUT_TOUS, &$objetDB)
{
$requete = 'select * from projet_statut' ;
if ($type_statut == PROJET_STATUT_SAUF_ADM) {
$requete .= ' where ps_id_statut <> 0' ;
}
if ($type_statut == PROJET_STATUT_SAUF_ADM_COORD) {
$requete .= ' where ps_id_statut > 1' ;
}
$resultat = $objetDB->query ($requete) ;
$tableau_resultat = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->ps_id_statut] = $ligne->ps_statut_nom ;
}
return $tableau_resultat;
} // end of member function getTousLesStatuts
 
 
 
 
 
} // end of statut
?>
/trunk/classes/statut_liste.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: statut_liste.class.php,v 1.2 2005/09/27 16:42:00 alexandre_tb Exp $
// CVS : $Id: statut_liste.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/HTML_formulaireListeExterne.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireListeExterne.class.php,v 1.2 2005/09/27 16:42:00 alexandre_tb Exp $
// CVS : $Id: HTML_formulaireListeExterne.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/projet_theme.class.php
1,103 → 1,103
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Application projet
*
* La classe projet_theme
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision:$
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_theme
{
 
/*** Attributes: ***/
 
/**
* Une connection vers une base de donnée
* @access private
*/
var $_db;
 
/**
* Renvoie tous types de projets (de la table projet_type) ans un tableau avec pour
* clé l'identifiant et pour valeur le label.
*
* @return Array
* @static
* @access public
*/
function getTousLesThemes(& $objetDB )
{
$requete = 'select * from projet_theme' ;
return $objetDB->getAssoc ($requete) ;
}
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_theme( & $objetDB )
{
$this->_db = $objetDB ;
}
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_theme from projet_theme where pt_id_theme='.$this->_db->escapeSimple($id_type) ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
}
}
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet_theme.class.php,v 1.1 2008-08-25 15:09:39 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet_theme
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_theme
{
 
/*** Attributes: ***/
 
/**
* Une connection vers une base de donnée
* @access private
*/
var $_db;
 
/**
* Renvoie tous types de projets (de la table projet_type) ans un tableau avec pour
* clé l'identifiant et pour valeur le label.
*
* @return Array
* @static
* @access public
*/
function getTousLesThemes(& $objetDB )
{
$requete = 'select * from projet_theme' ;
return $objetDB->getAssoc ($requete) ;
}
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_theme( & $objetDB )
{
$this->_db = $objetDB ;
}
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_theme from projet_theme where pt_id_theme='.$this->_db->escapeSimple($id_type) ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
}
}
?>
/trunk/classes/HTML_listeDocuments.class.php
1,402 → 1,390
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeDocuments.class.php,v 1.9 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
/**
* class HTML_listeDocuments
*
*/
class HTML_listeDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront pass�es en param�tre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du repertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des r�pertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
* le style d affichage
* @access private
*/
var $_mode_affichage ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function HTML_listeDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
$this->_mode_affichage = 'standart';
} // end of member function HTML_listeDocuments
 
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '', $id_projet = '' )
{
$this->HTML_listeDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels � afficher dans l'ent�te.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
}
 
/**
*
*
* @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '')
{
// mail('aurelien@tela-botanica.org','contenu de tableau documents', print_r($tableau_document,true));
if ($this->_mode_affichage == 'standart') {
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
//var_dump ($tableau_document);
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Premiere condition : est-ce que le fichier a pour pere le repertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un repertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument());
$this->_url->addQueryString('service', 'telechargement');
$lien = $this->_url->getURL() ;
$this->_url->removeQueryString('service');
$this->_url->removeQueryString('id_document');
if($this->_url->querystring[PROJET_VARIABLE_ID_PROJET] == null) {
$identifiant_projet =$tableau_document[$i]->_id_projet ;
}
else
{
$identifiant_projet =$this->_url->querystring[PROJET_VARIABLE_ID_PROJET] ;
}
//$lien = 'http://'.$this->_url->host.'/projets/'.$this->_url->querystring[PROJET_VARIABLE_ID_PROJET].'/telechargement/'.$tableau_document[$i]->getIdDocument();
$lien = 'http://'.$this->_url->host.'/projets/'.$identifiant_projet.'/telechargement/'.$tableau_document[$i]->getIdDocument();
}
// pour eviter des effets de bords, on enleve id_repertoire de l'url
// dans le cas d'un repertoire, pour les fichiers on le laisse pour
// qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insere le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
$taille = $tableau_document[$i]->getTailleFormatee();
// Recuperation de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau a donner en parametre a HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne enti�re (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->_url->removeQueryString('id_document');
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} else {
}
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
}
 
/**
*
*
* @param string le mode, valeur possible standart ou ajax
* @return void
* @access public
*/
function setModeAffichage( $mode )
{
$this->_mode_affichage = $mode ;
}
 
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
}
 
/**
* Surcharge de l'operation de la classe mere. Ajoute la navigation dans les
* repertoires.
*
* @return string
* @access public
*/
function toHTML($id_projet = '', $droits)
{
if ($this->_mode_affichage == 'standart') {
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i++) {
$chemin_navig .= "&gt;&nbsp;" ;
$doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']);
$nom = $doc->getNomLong() ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
} else {
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $this->_url->getURL();
// Le noeud racine
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">';
} else {
$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">';
}
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree.
'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>';
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la legende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
}
 
 
/**
* Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
}
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est a dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
$couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeDocuments.class.php,v 1.10 2008-08-25 15:14:17 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.10 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
/**
* class HTML_listeDocuments
*
*/
class HTML_listeDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront passées en paramètre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du repertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des répertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
* le style d affichage
* @access private
*/
var $_mode_affichage ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function HTML_listeDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
$this->_mode_affichage = 'standart';
} // end of member function HTML_listeDocuments
 
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '', $id_projet = '' )
{
$this->HTML_listeDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels à afficher dans l'entête.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
}
 
/**
*
*
* @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '')
{
if ($this->_mode_affichage == 'standart') {
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
//var_dump ($tableau_document);
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Premiere condition : est-ce que le fichier a pour pere le repertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un repertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument());
$this->_url->addQueryString('service', 'telechargement');
$lien = $this->_url->getURL() ;
$this->_url->removeQueryString('service');
$this->_url->removeQueryString('id_document');
$lien = 'http://'.$this->_url->host.'/projets/'.$this->_url->querystring[PROJET_VARIABLE_ID_PROJET].'/telechargement/'.$tableau_document[$i]->getIdDocument();
}
// pour eviter des effets de bords, on enleve id_repertoire de l'url
// dans le cas d'un repertoire, pour les fichiers on le laisse pour
// qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insere le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
$taille = $tableau_document[$i]->getTailleFormatee();
// Recuperation de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau a donner en parametre a HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->_url->removeQueryString('id_document');
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} else {
}
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
}
 
/**
*
*
* @param string le mode, valeur possible standart ou ajax
* @return void
* @access public
*/
function setModeAffichage( $mode )
{
$this->_mode_affichage = $mode ;
}
 
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
}
 
/**
* Surcharge de l'operation de la classe mere. Ajoute la navigation dans les
* repertoires.
*
* @return string
* @access public
*/
function toHTML($id_projet = '', $droits)
{
if ($this->_mode_affichage == 'standart') {
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i++) {
$chemin_navig .= "&gt;&nbsp;" ;
$doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']);
$nom = $doc->getNomLong() ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
} else {
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $this->_url->getURL();
// Le noeud racine
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">';
} else {
$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">';
}
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree.
'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>';
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la legende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
}
 
 
/**
* Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
}
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est a dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
$couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>
/trunk/classes/HTML_formulaireDocument.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireDocument.class.php,v 1.4 2007/02/13 15:11:39 jp_milcent Exp $
// CVS : $Id: HTML_formulaireDocument.class.php,v 1.4 2007-02-13 15:11:39 jp_milcent Exp $
/**
* Application projet
*
/trunk/classes/HTML_listeProjet.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeProjet.class.php,v 1.7 2006/09/15 12:35:54 alexandre_tb Exp $
// CVS : $Id: HTML_listeProjet.class.php,v 1.7 2006-09-15 12:35:54 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/HTML_formulaireCreationWikini.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireCreationWikini.class.php,v 1.2 2005/09/27 16:39:47 alexandre_tb Exp $
// CVS : $Id: HTML_formulaireCreationWikini.class.php,v 1.2 2005-09-27 16:39:47 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/HTML_formulaireMail.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireMail.class.php,v 1.3 2006/07/05 09:44:11 alexandre_tb Exp $
// CVS : $Id: HTML_formulaireMail.class.php,v 1.3 2006-07-05 09:44:11 alexandre_tb Exp $
/**
* Application projet
*
/trunk/classes/inscription_liste.class.php
1,236 → 1,238
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription_liste.class.php,v 1.5 2006/04/19 13:50:49 alexandre_tb Exp $
/**
* Application projet
*
* La classe inscription_liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class isncription_liste
*
*/
class inscription_liste
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste
* @access private
*/
var $_id_liste;
/**
* Identifiant de l'utilisateur
* @access private
*/
var $_id_utilisateur;
/**
* Une ressource PEAR::DB
* @access private
*/
var $_db;
/**
* Le type d'inscription indique : - 0 : pas d'email - 1 : normale - 2 : résumé
* @access private
*/
var $_type_inscription;
 
/**
* Constructeur
*
* @param DB objetDB Une ressource PEAR::DB
* @return void
* @access public
*/
function inscription_liste( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function inscription_liste
 
/**
* Renvoie un tableau avec la liste des inscrit à une liste.
*
* @param int id_liste L'identifiant de la liste
* @return Array
* @access public
*/
function getInscritsListe( $id_liste )
{
} // end of member function getInscritsListe
 
/**
*
*
* @param annire utilisateur
* @param liste_discussion id_liste
* @param int type_inscription
* @return void
* @access public
*/
function inscrireUtilisateur( &$utilisateur, &$liste, $type_inscription )
{
$requete = 'update projet_inscription_liste set '.
'pil_id_liste='.$liste->getId().', pil_id_statut='.$this->_db->escapeSimple($type_inscription).' where pil_id_utilisateur='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if ($this->_db->affectedRows() == 0) {
$requete = 'insert into projet_inscription_liste set pil_id_utilisateur='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')).
', pil_id_liste='.$this->_db->escapeSimple($liste->getId()).', pil_id_statut='.$this->_db->escapeSimple($type_inscription) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
// Ajout dans la liste des commandes au serveur
// On inscrit le créateur de la liste
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
} // end of member function inscrireUtilisateur
 
/**
*
*
* @param int id_utilisateur
* @param int id_liste
* @return void
* @access public
*/
function desinscrireUtilisateur( &$utilisateur, &$liste )
{
$requete = 'delete from projet_inscription_liste where pil_id_utilisateur='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')).' and pil_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
} // end of member function desinscrireUtilisateur
 
/**
*
*
* @param int id_liste
* @param int id_utilisateur
* @param int type_inscription
* @return void
* @access public
*/
function modifierTypeInscription( $liste, $utilisateur, $type_inscription )
{
 
// envoie d'une demande d'inscription par email à la liste
//include_once 'Mail.php' ;
switch ($type_inscription) {
case 0 :
 
// Ajout du modérateur en tant qu'utilisateur
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
break ;
case 1 :
break ;
case 2 :
 
// Ajout d'un utilisateur
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
break ;
}
} // end of member function modifierTypeInscription
 
/**
* Renvoie la liste des statuts d'un utilisateur
*
* @param int id_utilisateur
* @return Array
* @access public
*/
function getStatutsInscrit( $id_utilisateur )
{
$requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur) ;
$resultat = $this->_db->query ($requete) ;echo $requete;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->pil_id_liste] = $ligne->pil_id_statut ;
}
return $tableau_resultat ;
 
} // end of member function getStatutsInscrit
 
/**
* Renvoie le statut d'un inscrit à une liste
*
* @param int id_liste
* @param int id_utilisateur
* @return int
* @access public
*/
function getStatutInscrit( $id_liste, &$auth )
{
// Récupération de la liste des listes !!
$requete = 'select pl_nom_liste, pl_domaine from projet_liste where pl_id_liste='.$this->_db->escapeSimple($id_liste) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$xml = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/liste_abonnes.php?domaine='.
$ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
$tableau_mail = array() ;
$tableau_ligne = explode ('<email>', $xml) ;
foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
array_shift($tableau_mail) ;
if (in_array($auth->getUsername(), $tableau_mail)) {
return 2; // Inscrit est le statut 2
}
return 0 ;
} // end of member function getStatutInscrit
} // end of isncription_liste
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription_liste.class.php,v 1.5 2006-04-19 13:50:49 alexandre_tb Exp $
/**
* Application projet
*
* La classe inscription_liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class isncription_liste
*
*/
class inscription_liste
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste
* @access private
*/
var $_id_liste;
/**
* Identifiant de l'utilisateur
* @access private
*/
var $_id_utilisateur;
/**
* Une ressource PEAR::DB
* @access private
*/
var $_db;
/**
* Le type d'inscription indique : - 0 : pas d'email - 1 : normale - 2 : résumé
* @access private
*/
var $_type_inscription;
 
/**
* Constructeur
*
* @param DB objetDB Une ressource PEAR::DB
* @return void
* @access public
*/
function inscription_liste( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function inscription_liste
 
/**
* Renvoie un tableau avec la liste des inscrit à une liste.
*
* @param int id_liste L'identifiant de la liste
* @return Array
* @access public
*/
function getInscritsListe( $id_liste )
{
 
} // end of member function getInscritsListe
 
/**
*
*
* @param annire utilisateur
* @param liste_discussion id_liste
* @param int type_inscription
* @return void
* @access public
*/
function inscrireUtilisateur( &$utilisateur, &$liste, $type_inscription )
{
$requete = 'update projet_inscription_liste set '.
'pil_id_liste='.$this->_db->escapeSimple($liste->getId()).', pil_id_statut='.$this->_db->escapeSimple($type_inscription).
' where pil_id_utilisateur='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if ($this->_db->affectedRows() == 0) {
$requete = 'insert into projet_inscription_liste set pil_id_utilisateur='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')).
', pil_id_liste='.$this->_db->escapeSimple($liste->getId()).', pil_id_statut='.$this->_db->escapeSimple($type_inscription) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
 
// Ajout dans la liste des commandes au serveur
// On inscrit le créateur de la liste
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
} // end of member function inscrireUtilisateur
 
/**
*
*
* @param int id_utilisateur
* @param int id_liste
* @return void
* @access public
*/
function desinscrireUtilisateur( &$utilisateur, &$liste )
{
$requete = 'delete from projet_inscription_liste where pil_id_utilisateur='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')).
' and pil_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
} // end of member function desinscrireUtilisateur
 
/**
*
*
* @param int id_liste
* @param int id_utilisateur
* @param int type_inscription
* @return void
* @access public
*/
function modifierTypeInscription( $liste, $utilisateur, $type_inscription )
{
 
// envoie d'une demande d'inscription par email à la liste
//include_once 'Mail.php' ;
 
switch ($type_inscription) {
case 0 :
 
// Ajout du modérateur en tant qu'utilisateur
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
break ;
case 1 :
 
break ;
case 2 :
 
// Ajout d'un utilisateur
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
break ;
}
} // end of member function modifierTypeInscription
 
/**
* Renvoie la liste des statuts d'un utilisateur
*
* @param int id_utilisateur
* @return Array
* @access public
*/
function getStatutsInscrit( $id_utilisateur )
{
 
$requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur) ;
$resultat = $this->_db->query ($requete) ;echo $requete;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->pil_id_liste] = $ligne->pil_id_statut ;
}
return $tableau_resultat ;
 
 
} // end of member function getStatutsInscrit
 
/**
* Renvoie le statut d'un inscrit à une liste
*
* @param int id_liste
* @param int id_utilisateur
* @return int
* @access public
*/
function getStatutInscrit( $id_liste, &$auth )
{
 
// Récupération de la liste des listes !!
$requete = 'select pl_nom_liste, pl_domaine from projet_liste where pl_id_liste='.$this->_db->escapeSimple($id_liste) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$xml = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/liste_abonnes.php?domaine='.
$ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
$tableau_mail = array() ;
$tableau_ligne = explode ('<email>', $xml) ;
foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
array_shift($tableau_mail) ;
if (in_array($auth->getUsername(), $tableau_mail)) {
return 2; // Inscrit est le statut 2
}
return 0 ;
} // end of member function getStatutInscrit
} // end of isncription_liste
?>
/trunk/classes/annuaire.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.class.php,v 1.5 2006/07/04 09:25:38 alexandre_tb Exp $
// CVS : $Id: annuaire.class.php,v 1.5 2006-07-04 09:25:38 alexandre_tb Exp $
/**
* Application annuaire
*
/trunk/classes/projet.class.php
1,986 → 1,1000
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.class.php,v 1.12 2008-05-21 14:35:26 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php' ;
/* Permet la r�cup�ration d'un nouvel identifiant d'une table.*/
require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
include_once 'Mail.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
 
/**
* class projet
*
*/
class projet
{
 
/** Aggregations: */
 
/**
* Le tableau d'objet document associ�s au projet
*
*/
var $_documents_associes = array();
 
var $_listes_associes = array();
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du projet.
* @access private
*/
var $_id_projet;
 
/**
* Le titre du projet, tel que dans la base de donn�e.
* @access private
*/
var $_titre;
/**
* La description du projet, tel que dans la base.
* @access private
*/
var $_description;
/**
* L'URL d'un site sur le projet. Facultatif.
* @access private
*/
var $_espace_internet;
/**
* Le nom du wikini associ� au projet, avec la syntaxe wikini. Vide par d�faut.
* @access private
*/
var $_nom_wikini;
/**
* Date de cr�ation du projet. A priori ne varie pas dans le temps.
* @access private
*/
var $_date_creation;
/**
* Le chemin relatif vers le r�pertoire contenant les wikinis.
* @access private
*/
var $_chemin_wikini;
/**
* Une connexion vers la base de donn�e.
* @access private
*/
var $_db;
 
/**
* Contient le nom du r�pertoire du projet tel que sur le disque.
* @access private
*/
var $_nom_repertoire;
 
/**
* Le chemin jusqu'au r�pertoire o� seront stock�s les fichiers.
* @access private
*/
var $_chemin_repertoire;
 
/**
* Vaut vrai si le projet est un projet racine et s'il est le seul.
* @access private
*/
var $_est_racine;
/**
* Le r�sum� du projet
* @access private
*/
var $_resume;
/**
* Contient le num�ro du type du projet
* @access private
*/
var $_type;
 
/**
* Indique si l'inscription au projet est moderes
* @access private
*/
var $_isModere;
 
/**
* Indique si le projet a des documents
* @access private
*/
var $_avoirDocument;
/**
* tableau contenant les themes associes au projet
*/
var $_themes = array();
/**
*
* PHP5
* @return projet
* @access public
*/
function __construct( &$dbObject, $id_projet = "")
{
$this->projet($dbObject, $id_projet);
 
} // end of member function __construct
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur. Cela lui permet de faire une
* premiere requete pour les infos de bases comme le titre, le description etc.
* @return projet
* @access public
*/
function projet( &$dbObject, $id_projet = "")
{
$this->_db = $dbObject ;
if ($id_projet != "") {
$requete = "select * from projet where p_id=".$this->_db->escapeSimple($id_projet)." " ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
 
// Affectations dans les proprietes
$this->_id_projet = $ligne->p_id ;
$this->_titre = $ligne->p_titre ;
$this->_description = $ligne->p_description ;
$this->_espace_internet = $ligne->p_espace_internet ;
$this->_date_creation = $ligne->p_date_creation ;
$this->_nom_wikini = $ligne->p_wikini ;
$this->_resume = $ligne->p_resume;
$this->_type = $ligne->p_type ;
// On recupere le nom du repertoire
$this->_nom_repertoire = $ligne->p_nom_repertoire ;
$this->_isModere = $ligne->p_modere;
$this->_avoirDocument = $ligne->p_avoir_document;
// on regarde si on a a faire au projet racine
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'select ph_id_projet_pere, ph_id_projet_fils from projet_hierarchie where ph_id_projet_fils='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$this->_est_racine = true ;
} else {
$this->_est_racine = false ;
}
}
/** Recuperation des themes */
$requete_theme = 'select pat_id_theme, pt_label_theme from projet_avoir_theme, projet_theme'.
' where pat_id_projet='.$this->_db->escapeSimple($this->_id_projet).' and pat_id_theme=pt_id_theme';
$resultat_theme = $GLOBALS['projet_db']->query ($requete_theme);
if (DB::isError($resultat_theme)) {
return ("Echec de la requete : $requete_theme<br />".$resultat_theme->getMessage()) ;
}
if ($resultat_theme->numRows() != 0) {
while ($ligne_theme = $resultat_theme->fetchRow(DB_FETCHMODE_OBJECT)) {
$this->_themes[$ligne_theme->pat_id_theme] = $ligne_theme->pt_label_theme;
}
}
}
} // end of member function projet
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur.
* @return bool
* @access public
*/
function projetExiste( &$dbObject, $id_projet)
{
if ($id_projet != "") {
$requete = "select * from projet where p_id=".$dbObject->escapeSimple($id_projet)." " ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
return true ;
}
}
} // end of member function projet
 
/**
*
*
* @param int id_projet
* @return string
* @access public
*/
function getTitre( $id_projet = "" )
{
return $this->_titre ;
} // end of member function getTitre
 
/**
*
*
* @return string
* @access public
*/
function getResume( )
{
return $this->_resume ;
} // end of member function getResume
 
/**
* Renvoie l'identifiant du projet courant.
*
* @return int
* @access public
*/
function getId( )
{
return $this->_id_projet ;
} // end of member function getId
 
/**
*
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description;
} // end of member function getDescription
 
/**
*
*
* @return string
* @access public
*/
function getEspaceInternet( )
{
return $this->_espace_internet;
} // end of member function getEspaceInternet
 
/**
* Charge dans l'objet projet, les listes de discussion
* ['nom_liste']
* ['domaine']
* ['adresse']
*
* @return boolean true en cas de succ�s
* @access public
*/
function getListesAssociees( )
{
// On rajoute un test pour eviter l'appel SQL si il a deja ete fait une fois
if (count($this->_listes_associes) > 0) return ;
$requete = "select pl_id_liste from projet_lien_liste where pl_id_projet=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$retour = array() ;
if ($resultat->numRows()) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_listes_associes[] = new liste_discussion($ligne->pl_id_liste, $this->_db) ;
 
}
} // end of member function getListesAssociees
 
/**
* Renvoie vrai si le projet a au moins une liste
*
* @return bool
* @access public
*/
function avoirListe( )
{
$this->getListesAssociees() ;
if (count($this->_listes_associes)) {
return true ;
}
return false ;
}
 
/**
* Renvoie vrai si le projet a au moins un document, fichier ou repertoire
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @return bool
* @access public
*/
function avoirDocument( )
{
return $this->_avoirDocument;
}
 
/**
* Permet de fixer la colonne p_avoir_document a 1
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @param bool
* @return mixed true si la requete fonctionne
* @access public
*/
function setAvoirDocument($bool)
{
$val = 0 ;
if ($bool) $val = 1;
$requete = 'update projet set p_avoir_document='.$this->_db->escapeSimple($val).' where p_id='.$this->_db->escapeSimple($this->_id_projet);
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return true;
}
 
/**
* Renvoie la liste des documents associes sous forme d'un tableau, avec les
* informations afferentes. 0 => "nom (cliquable)"
"Taille"
"Date
* de creation" "Prorietaire" "Visibilite" "Action
* (cliquable)"
*
* @param visibilite visibilite Si visibilite est prive, tous les fichiers sont renvoyes ainsi qu'une entree
* pour indiquer la visibilite du document.
* @return Array
* @access public
*/
function getListesDocuments( $chemin, $chemin_icones = "icones/", $id_repertoire = '', $date = '' )
{
// On realise une requete sur projet_documents avec une jointure sur l'annuaire
// et sur gen_type_de_fichier pour envoyer un resultat complet.
// On exclue les fichiers racines cad pd_pere is null
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_db->escapeSimple($this->_id_projet) ;
if ($id_repertoire != '') $requete .= ' and pd_pere='.$this->_db->escapeSimple($id_repertoire);
if ($id_repertoire != '' && $id_repertoire == 0) $requete .= ' and pd_pere=0';
if ($date != '') $requete .= ' and pd_date_de_mise_a_jour > date_sub (NOW(), interval 1 week)';
$requete .= ' order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
// Un compteur
$i = 0 ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $i, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
}
 
 
/**
* Renvoie un tableau avec tous les repertoires d'un projet, imbrique. ['rep1'],
* ['rep2'] => array (['rep21'], ['rep22']), etc .
*
* @return Array
* @access public
*/
function getListeRepertoireHierarchisee( )
{
// On ne prend que les repertoires
$requete = "select pd_id, pd_pere, pd_nom from projet_documents where pd_ce_projet=".$this->_db->escapeSimple($this->_id_projet).' and pd_ce_type=0 order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
/*
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $this->_db));
}
*/
$tableau = array();
$tab = array();
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau, array ('id' => $ligne->pd_id,
'id_pere' => $ligne->pd_pere,
'fils' => array(),
'label' => $ligne->pd_nom));
 
}
// la $tableau reste un tableau de valeur a plat
$i = 0;
foreach ($tableau as $noeud) {
// On teste si le noeud est racine si oui on l ajoute a l arbre sinon on ne l ajoute pas
if ($noeud['id_pere'] == 0) {
$tab[$i] = $noeud;
$this->construireArbre($tab[$i], $tableau) ;
}
$i++;
}
return $tab;
} // end of member function getListeRepertoireHierarchisee
 
function construireArbre(&$noeud, $tableau) {
$j = 0;
foreach ($tableau as $element) {
// pour chaque element on teste
if ($element['id_pere'] == $noeud['id']) {
$noeud['fils'][$j]= $element ;
$this->construireArbre($noeud['fils'][$j],$tableau);
}
$j++;
}
}
 
/**
* Renvoie un tableau comprenant tous les objets projet de la base.
*
* @return Array
* @static
* @access public
*/
function getTousLesProjets(&$objetDB, $exclu = '')
{
$sql = '';
if (is_object($this) && isset ($this->_projet_exclu) && count($this->_projet_exclu)) {
$sql = 'where p_id not in (';
foreach ($this->_projet_exclu as $valeur) {
$sql .= $objetDB->escapeSimple($valeur).',' ;
}
$sql[count($sql)-1] = ')';
}
$requete = 'select p_id from projet '.$sql.' order by p_titre' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un tableau comprenant les objets projet de la base du type $type.
*
* @return Array
* @static
* @access public
*/
function getProjetDuType($type, &$objetDB)
{
$requete = "select p_id from projet where p_type= ".$objetDB->escapeSimple($type)." order by p_titre" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un le projet racine.
*
* @return projet
* @static
* @access public
*/
function getProjetRacine(&$objetDB)
{
$requete = "select p_id from projet where p_id not in (select ph_id_projet_fils from projet_hierarchie)" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 1) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return new projet($objetDB, $ligne->p_id) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Desctructeur de la classe. Libere la memoire, ferme les connexions et fichiers.
*
* @return void
* @access public
*/
function __destruct( )
{
 
} // end of member function __destruct
 
/**
* Supprime le projet courrant. Il s'ensuit une suppression en cascade de tous les
* elements lies.
*
* @return void
* @access public
*/
function supprimer( )
{
 
} // end of member function supprimer
 
/**
* Permet d'enregistrer une ligne dans la table concernee.
*
* @param Array tableau_de_valeur Le tableau de valeur a inserer dans la base avec pour cle les noms des elements
* du formulaire.
* @return int
* @access public
*/
function enregistrerSQL( $tableau_de_valeur )
{
$nom_repertoire = projet::genereNomRepertoire($tableau_de_valeur['projet_titre'], $this->_db) ;
if (!$this->_creationRepertoire ($nom_repertoire)) {
echo 'Impossible de cr&eacute;e un r&eacute;pertoire'.$nom_repertoire ;
return false ;
}
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$id = SQL_obtenirNouveauId($this->_db, 'projet', 'p_id') ;
$requete = 'insert into projet set p_id='.$this->_db->escapeSimple($id) ;
if (!isset($tableau_de_valeur['projet_wikini'])) {
$tableau_de_valeur['projet_wikini']='';
}
$requete .= ', p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'", p_date_creation=NOW()'.
', p_wikini="'.$tableau_de_valeur['projet_wikini'].'", p_nom_repertoire="'.$nom_repertoire.'", p_resume="'.$tableau_de_valeur['projet_resume'].
'", p_type="'.$tableau_de_valeur['projet_type'].'", p_modere="'.$tableau_de_valeur['projet_moderation'].'"' ;
$resultat = $this->_db->query ($requete) ;
 
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
// On affecte a l'objet projet son identifiant
$this->_id_projet = $id ;
 
//insertion dans projet_herarchie
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$this->_db->escapeSimple($tableau_de_valeur['projet_asso']).
', ph_id_projet_fils='.$id ;
$resultat = $this->_db->query ($requete) ;
}
/** enregistrement dans projet_avoir_theme */
$requete_theme = '';
foreach ($tableau_de_valeur['projet_theme'] as $cle => $valeur) {
$requete_theme = 'insert into projet_avoir_theme set pat_id_projet='.$this->_db->escapeSimple($id).', pat_id_theme='.$this->_db->escapeSimple($cle);
$resultat_theme = $GLOBALS['projet_db']->query($requete_theme);
if (DB::isError($resultat_theme)) {
return $resultat_theme->getMessage();
}
}
return true ;
}
 
/**
* Permet de mettre a jour une ligne dans la table concernee.
*
* @param Array tableau_de_valeur Le tableau de valeur a inserer dans la base avec pour cle les noms des elements
* du formulaire.
* @return int
* @access public
*/
function majSQL( $tableau_de_valeur )
{
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$requete = 'update projet set ';
$requete .= 'p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'"'.
', p_resume="'.$tableau_de_valeur['projet_resume'].'", p_type="'.$tableau_de_valeur['projet_type'].'"'.
', p_modere='.$tableau_de_valeur['projet_moderation'].
' where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
if (PROJET_UTILISE_HIERARCHIE) {
// suppression dans projet_hierarchie
 
$requete = 'delete from projet_hierarchie where ph_id_projet_fils='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
 
//insertion dans projet_hierarchie
 
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$this->_db->escapeSimple($tableau_de_valeur['projet_asso']).
', ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
/** enregistrement dans projet_avoir_theme */
$requete_suppression_theme = 'delete from projet_avoir_theme where pat_id_projet='.$this->_db->escapeSimple($this->_id_projet);
$resultat_suppression_theme = $GLOBALS['projet_db']->query($requete_suppression_theme);
$requete_theme = '';
foreach ($tableau_de_valeur['projet_theme'] as $cle => $valeur) {
$requete_theme = 'insert into projet_avoir_theme set pat_id_projet='.$this->_db->escapeSimple($this->_id_projet).', pat_id_theme='.$this->_db->escapeSimple($cle);
$resultat_theme = $GLOBALS['projet_db']->query($requete_theme);
if (DB::isError($resultat_theme)) {
return $resultat_theme->getMessage();
}
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Met a jour dans la base de donnee le champs p_nom_wikini
*
* @param int nom_wikini Le nouveau nom wikini
* @return bool
* @access public
*/
function majNomWikini( $nom_wikini )
{
$requete = 'update projet set p_wikini="'.$nom_wikini.'" where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function majNomWikini
 
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$msg = '' ;
// Supression du repertoire du projet
if (!$this->_suppression_repertoire()) {
$msg = 'La suppression du repertoire n\'a pas fonctionne' ;
}
// A ajouter la suppression des documents associes
 
// La suppression des evenements associ�s
 
// Le projet lui-meme
$requete = "delete from projet where p_id=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
 
if (PROJET_UTILISE_HIERARCHIE) {
$requete = "delete from projet_hierarchie where ph_id_projet_fils=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
}
$requete = "delete from projet_statut_utilisateurs where psu_id_projet=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
return $msg ;
} // end of member function suppressionSQL
 
/**
* Supprime le repertoire associe au projet (le repertoire doit etre vide).
*
* @return void
* @access private
*/
function _suppression_repertoire( )
{
return rmdir ($this->_chemin_repertoire.$this->_nom_repertoire) ;
} // end of member function _suppression_repertoire
 
/**
* Permet de creer le repertoire associe au projet.
*
* @param string nom_repertoire Le nom du r�pertoire � cr�er.
* @return boolean
* @access private
*/
function _creationRepertoire( $nom_repertoire )
{
return mkdir ($this->_chemin_repertoire.$nom_repertoire) ;
} // end of member function _creationRepertoire
 
/**
* Permet d'indiquer ou seront stockes les fichiers.
*
* @param string cheminRepertoire Le chemin jusqu'au repertoire ou seront stockes les fichiers.
* @return void
* @access public
*/
function setCheminRepertoire( $cheminRepertoire )
{
$this->_chemin_repertoire = $cheminRepertoire ;
} // end of member function setCheminRepertoire
 
/**
* Genere un nom de repertoire a partir de la premiere lettre de la chaine passe en
* parametre et de l'identifiant du dernier projet.
*
* @param string chaine Une chaine a partir de laquelle sera generer le nom du repertoire.
* @param DB objetDB un objet PEAR::DB
* @return string
* @static
* @access public
*/
function genereNomRepertoire( $chaine, &$objetDB )
{
$requete = "select p_id from projet order by p_id desc limit 0,1" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() > 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= $ligne->p_id + 1 ;
}
else {
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= 1 ;
}
return $nom ;
 
} // end of member function genereNomRepertoire
 
/**
* Permet de recuperer le nom du repertoire d'un projet.
*
* @return string
* @access public
*/
function getNomRepertoire( )
{
return $this->_nom_repertoire ;
} // end of member function getNomRepertoire
 
/**
* Ajoute une liste a un projet
* Effectue une insertion dans projet_lien_liste
*
* @param liste_discussion liste Une instance de la classe liste_discussion
* @return void
* @access public
*/
function ajouterListe( &$liste )
{
$requete = "insert into projet_lien_liste set pl_id_liste=".$this->_db->escapeSimple($liste->getId()).
', pl_id_projet='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
}
 
/**
* Supprime la liste de discussion associee au projet
*
* @return void
* @access public
*/
function supprimerListe(&$liste)
{
$requete = 'delete from projet_lien_liste where pl_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$requete = 'delete from projet_liste where pl_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
 
 
/**
* Renvoie vrai si le projet est racine.
*
* @return bool
* @access public
*/
function isRacine( )
{
return $this->_est_racine ;
} // end of member function isRacine
 
/**
* Renvoie le nombre d'inscrits au projet. Effectue une requete dans la table
* projet_statut_utilisateurs
*
* @return int
* @access public
*/
function getNombreInscrits( )
{
$requete = 'select count(psu_id_utilisateur) as nbre from projet_statut_utilisateurs where psu_id_projet='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->nbre ;
} // end of member function getNombreInscrits
 
 
/**
* Renvoie un tableau contenant les identifiants des fils du projet courant.
*
* @return Array
* @access public
*/
function getHierarchie( )
{
$requete = 'select ph_id_projet_fils from projet_hierarchie where ph_id_projet_pere='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->ph_id_projet_fils) ;
}
return $tableau_resultat ;
} // end of member function getHierarchie
 
/**
* Renvoie l'identifiant du pere du projet courrant.
*
* @return int
* @access public
*/
function getIdPere()
{
$requete = 'select ph_id_projet_pere from projet_hierarchie where ph_id_projet_fils='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->ph_id_projet_pere ;
} // end of member function getIdPere()
 
/**
* Renvoie le nom Wiki du wikini associe au projet.
*
* @return string
* @access public
*/
function getWikini( )
{
return $this->_nom_wikini ;
} // end of member function getWikini
 
/**
* Renvoie le type du projet, ou zero si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getType( )
{
return $this->_type ;
} // end of member function getType
 
/**
* Renvoie les themes du projet, ou zero si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getThemes( )
{
return $this->_themes ;
} // end of member function getType
 
/**
* Renvoie 1 si les inscriptions au projet sont moderees.
*
* @return int
* @access public
*/
function isModere( )
{
return $this->_isModere ;
} // end of member function getType
 
 
 
/**
* initAttributes sets all projet attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->chemin_wikini = "projet/wikini/";
}
 
 
} // end of projet
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.class.php,v 1.14 2008-09-16 14:11:05 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.14 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php' ;
/* Permet la recuperation d'un nouvel identifiant d'une table.*/
require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
include_once 'Mail.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
 
/**
* class projet
*
*/
class projet
{
 
/** Aggregations: */
 
/**
* Le tableau d'objet document associés au projet
*
*/
var $_documents_associes = array();
 
var $_listes_associes = array();
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du projet.
* @access private
*/
var $_id_projet;
 
/**
* Le titre du projet, tel que dans la base de donnée.
* @access private
*/
var $_titre;
/**
* La description du projet, tel que dans la base.
* @access private
*/
var $_description;
/**
* L'URL d'un site sur le projet. Facultatif.
* @access private
*/
var $_espace_internet;
/**
* Le nom du wikini associe au projet, avec la syntaxe wikini. Vide par defaut.
* @access private
*/
var $_nom_wikini;
/**
* Date de creation du projet. A priori ne varie pas dans le temps.
* @access private
*/
var $_date_creation;
/**
* Le chemin relatif vers le repertoire contenant les wikinis.
* @access private
*/
var $_chemin_wikini;
/**
* Une connexion vers la base de donnee.
* @access private
*/
var $_db;
 
/**
* Contient le nom du repertoire du projet tel que sur le disque.
* @access private
*/
var $_nom_repertoire;
 
/**
* Le chemin jusqu'au repertoire ou seront stockes les fichiers.
* @access private
*/
var $_chemin_repertoire;
 
/**
* Vaut vrai si le projet est un projet racine et s'il est le seul.
* @access private
*/
var $_est_racine;
/**
* Le resume du projet
* @access private
*/
var $_resume;
/**
* Contient le numero du type du projet
* @access private
*/
var $_type;
 
/**
* Indique si l'inscription au projet est moderes
* @access private
*/
var $_isModere;
 
/**
* Indique si le projet a des documents
* @access private
*/
var $_avoirDocument;
 
/**
* tableau contenant les themes associes au projet
*/
var $_themes = array();
/**
*
* PHP5
* @return projet
* @access public
*/
function __construct( &$dbObject, $id_projet = "")
{
$this->projet($dbObject, $id_projet);
 
} // end of member function __construct
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur. Cela lui permet de faire une
* premiere requete pour les infos de bases comme le titre, le description etc.
* @return projet
* @access public
*/
function projet( &$dbObject, $id_projet = "")
{
$this->_db = $dbObject ;
if (intval($id_projet)) {
$resultat = $this->_db->query(sprintf("SELECT * FROM projet WHERE p_id=%d -- %s",
intval($id_projet),
__FILE__ . ':' . __LINE__));
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
 
// Affectations dans les proprietes
$this->_id_projet = $ligne->p_id ;
$this->_titre = $ligne->p_titre ;
$this->_description = $ligne->p_description ;
$this->_espace_internet = $ligne->p_espace_internet ;
$this->_date_creation = $ligne->p_date_creation ;
$this->_nom_wikini = $ligne->p_wikini ;
$this->_resume = $ligne->p_resume;
$this->_type = $ligne->p_type ;
// On recupere le nom du repertoire
$this->_nom_repertoire = $ligne->p_nom_repertoire ;
$this->_isModere = $ligne->p_modere;
$this->_avoirDocument = $ligne->p_avoir_document;
// on regarde si on a a faire au projet racine
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'select ph_id_projet_pere, ph_id_projet_fils from projet_hierarchie where ph_id_projet_fils='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$this->_est_racine = true ;
} else {
$this->_est_racine = false ;
}
}
 
/** Recuperation des themes */
$requete_theme = 'select pat_id_theme, pt_label_theme from projet_avoir_theme, projet_theme'.
' where pat_id_projet='.$this->_db->escapeSimple($this->_id_projet).' and pat_id_theme=pt_id_theme';
$resultat_theme = $GLOBALS['projet_db']->query ($requete_theme);
if (DB::isError($resultat_theme)) {
return ("Echec de la requete : $requete_theme<br />".$resultat_theme->getMessage()) ;
}
if ($resultat_theme->numRows() != 0) {
 
while ($ligne_theme = $resultat_theme->fetchRow(DB_FETCHMODE_OBJECT)) {
$this->_themes[$ligne_theme->pat_id_theme] = $ligne_theme->pt_label_theme;
}
 
}
}
} // end of member function projet
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur.
* @return bool
* @access public
*/
function projetExiste( &$dbObject, $id_projet)
{
if (intval($id_projet)) {
$resultat = $dbObject->query(sprintf("SELECT * FROM projet WHERE p_id=%d -- %s",
intval($id_projet),
__FILE__ . ':' . __LINE__));
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
return true ;
}
}
} // end of member function projet
 
/**
*
*
* @param int id_projet
* @return string
* @access public
*/
function getTitre( $id_projet = "" )
{
return $this->_titre ;
} // end of member function getTitre
 
/**
*
*
* @return string
* @access public
*/
function getResume( )
{
return $this->_resume ;
} // end of member function getResume
 
/**
* Renvoie l'identifiant du projet courant.
*
* @return int
* @access public
*/
function getId( )
{
return $this->_id_projet ;
} // end of member function getId
 
/**
*
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description;
} // end of member function getDescription
 
/**
*
*
* @return string
* @access public
*/
function getEspaceInternet( )
{
return $this->_espace_internet;
} // end of member function getEspaceInternet
 
/**
* Charge dans l'objet projet, les listes de discussion
* ['nom_liste']
* ['domaine']
* ['adresse']
*
* @return boolean true en cas de succès
* @access public
*/
function getListesAssociees( )
{
// On rajoute un test pour eviter l'appel SQL si il a deja ete fait une fois
if (count($this->_listes_associes) > 0) return ;
$requete = "select pl_id_liste from projet_lien_liste where pl_id_projet=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$retour = array() ;
if ($resultat->numRows()) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_listes_associes[] = new liste_discussion($ligne->pl_id_liste, $this->_db) ;
 
}
} // end of member function getListesAssociees
 
/**
* Renvoie vrai si le projet a au moins une liste
*
* @return bool
* @access public
*/
function avoirListe( )
{
$this->getListesAssociees() ;
if (count($this->_listes_associes)) {
return true ;
}
return false ;
}
 
/**
* Renvoie vrai si le projet a au moins un document, fichier ou repertoire
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @return bool
* @access public
*/
function avoirDocument( )
{
return $this->_avoirDocument;
}
 
/**
* Permet de fixer la colonne p_avoir_document a 1
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @param bool
* @return mixed true si la requete fonctionne
* @access public
*/
function setAvoirDocument($bool)
{
$val = 0 ;
if ($bool) $val = 1;
$requete = 'update projet set p_avoir_document='.$this->_db->escapeSimple($val).' where p_id='.$this->_db->escapeSimple($this->_id_projet);
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return true;
}
 
/**
* Renvoie la liste des documents associes sous forme d'un tableau, avec les
* informations afferentes. 0 => "nom (cliquable)"
"Taille"
"Date
* de creation" "Prorietaire" "Visibilite" "Action
* (cliquable)"
*
* @param visibilite visibilite Si visibilite est prive, tous les fichiers sont renvoyes ainsi qu'une entree
* pour indiquer la visibilite du document.
* @return Array
* @access public
*/
function getListesDocuments( $chemin, $chemin_icones = "icones/", $id_repertoire = '', $date = '' )
{
// On realise une requete sur projet_documents avec une jointure sur l'annuaire
// et sur gen_type_de_fichier pour envoyer un resultat complet.
// On exclue les fichiers racines cad pd_pere is null
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_db->escapeSimple($this->_id_projet) ;
if ($id_repertoire != '') $requete .= ' and pd_pere='.$this->_db->escapeSimple($id_repertoire);
if ($id_repertoire != '' && $id_repertoire == 0) $requete .= ' and pd_pere=0';
if ($date != '') $requete .= ' and pd_date_de_mise_a_jour > date_sub (NOW(), interval 1 week)';
$requete .= ' order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
// Un compteur
$i = 0 ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $i, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
}
 
 
/**
* Renvoie un tableau avec tous les repertoires d'un projet, imbrique. ['rep1'],
* ['rep2'] => array (['rep21'], ['rep22']), etc .
*
* @return Array
* @access public
*/
function getListeRepertoireHierarchisee( )
{
// On ne prend que les repertoires
$requete = "select pd_id, pd_pere, pd_nom from projet_documents where pd_ce_projet=".$this->_db->escapeSimple($this->_id_projet).' and pd_ce_type=0 order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
/*
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $this->_db));
}
*/
$tableau = array();
$tab = array();
 
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau, array ('id' => $ligne->pd_id,
'id_pere' => $ligne->pd_pere,
'fils' => array(),
'label' => $ligne->pd_nom));
 
}
 
// la $tableau reste un tableau de valeur a plat
 
 
$i = 0;
foreach ($tableau as $noeud) {
// On teste si le noeud est racine si oui on l ajoute a l arbre sinon on ne l ajoute pas
if ($noeud['id_pere'] == 0) {
$tab[$i] = $noeud;
$this->construireArbre($tab[$i], $tableau) ;
}
$i++;
}
return $tab;
} // end of member function getListeRepertoireHierarchisee
 
function construireArbre(&$noeud, $tableau) {
$j = 0;
foreach ($tableau as $element) {
// pour chaque element on teste
if ($element['id_pere'] == $noeud['id']) {
$noeud['fils'][$j]= $element ;
$this->construireArbre($noeud['fils'][$j],$tableau);
}
$j++;
}
}
 
/**
* Renvoie un tableau comprenant tous les objets projet de la base.
*
* @return Array
* @static
* @access public
*/
function getTousLesProjets(&$objetDB, $exclu = '')
{
$sql = '';
if (is_object($this) && isset ($this->_projet_exclu) && count($this->_projet_exclu)) {
$sql = 'where p_id not in (';
foreach ($this->_projet_exclu as $valeur) {
$sql .= $objetDB->escapeSimple($valeur).',' ;
}
$sql[count($sql)-1] = ')';
}
$requete = 'select p_id from projet '.$sql.' order by p_titre' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un tableau comprenant les objets projet de la base du type $type.
*
* @return Array
* @static
* @access public
*/
function getProjetDuType($type, &$objetDB)
{
$requete = "select p_id from projet where p_type=".$objetDB->escapeSimple($type)." order by p_titre" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un le projet racine.
*
* @return projet
* @static
* @access public
*/
function getProjetRacine(&$objetDB)
{
$requete = "select p_id from projet where p_id not in (select ph_id_projet_fils from projet_hierarchie)" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 1) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return new projet($objetDB, $ligne->p_id) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Desctructeur de la classe. Libere la memoire, ferme les connexions et fichiers.
*
* @return void
* @access public
*/
function __destruct( )
{
 
} // end of member function __destruct
 
/**
* Supprime le projet courrant. Il s'ensuit une suppression en cascade de tous les
* elements lies.
*
* @return void
* @access public
*/
function supprimer( )
{
 
} // end of member function supprimer
 
/**
* Permet d'enregistrer une ligne dans la table concernee.
*
* @param Array tableau_de_valeur Le tableau de valeur a inserer dans la base avec pour cle les noms des elements
* du formulaire.
* @return int
* @access public
*/
function enregistrerSQL( $tableau_de_valeur )
{
$nom_repertoire = projet::genereNomRepertoire($tableau_de_valeur['projet_titre'], $this->_db) ;
if (!$this->_creationRepertoire ($nom_repertoire)) {
echo 'Impossible de cr&eacute;e un r&eacute;pertoire'.$nom_repertoire ;
return false ;
}
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$id = SQL_obtenirNouveauId($this->_db, 'projet', 'p_id') ;
$requete = 'insert into projet set p_id='.$this->_db->escapeSimple($id) ;
if (!isset($tableau_de_valeur['projet_wikini'])) {
$tableau_de_valeur['projet_wikini']='';
}
$requete .= ', p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'", p_date_creation=NOW()'.
', p_wikini="'.$tableau_de_valeur['projet_wikini'].'", p_nom_repertoire="'.$nom_repertoire.'", p_resume="'.$tableau_de_valeur['projet_resume'].
'", p_type="'.$tableau_de_valeur['projet_type'].'", p_modere="'.$tableau_de_valeur['projet_moderation'].'"' ;
$resultat = $this->_db->query ($requete) ;
 
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
// On affecte a l'objet projet son identifiant
$this->_id_projet = $id ;
 
//insertion dans projet_herarchie
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$this->_db->escapeSimple($tableau_de_valeur['projet_asso']).
', ph_id_projet_fils='.$this->_db->escapeSimple($id) ;
$resultat = $this->_db->query ($requete) ;
}
 
/** enregistrement dans projet_avoir_theme */
$requete_theme = '';
foreach ($tableau_de_valeur['projet_theme'] as $cle => $valeur) {
$requete_theme = 'insert into projet_avoir_theme set pat_id_projet='.$this->_db->escapeSimple($id).', pat_id_theme='.$this->_db->escapeSimple($cle);
$resultat_theme = $GLOBALS['projet_db']->query($requete_theme);
if (DB::isError($resultat_theme)) {
return $resultat_theme->getMessage();
}
}
return true ;
}
 
/**
* Permet de mettre a jour une ligne dans la table concernee.
*
* @param Array tableau_de_valeur Le tableau de valeur a inserer dans la base avec pour cle les noms des elements
* du formulaire.
* @return int
* @access public
*/
function majSQL( $tableau_de_valeur )
{
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$requete = 'update projet set ';
$requete .= 'p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'"'.
', p_resume="'.$tableau_de_valeur['projet_resume'].'", p_type="'.$tableau_de_valeur['projet_type'].'"'.
', p_modere='.$tableau_de_valeur['projet_moderation'].
' where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
if (PROJET_UTILISE_HIERARCHIE) {
// suppression dans projet_hierarchie
 
$requete = 'delete from projet_hierarchie where ph_id_projet_fils='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
 
//insertion dans projet_hierarchie
 
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$this->_db->escapeSimple($tableau_de_valeur['projet_asso']).
', ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
 
/** enregistrement dans projet_avoir_theme */
 
$requete_suppression_theme = 'delete from projet_avoir_theme where pat_id_projet='.$this->_db->escapeSimple($this->_id_projet);
$resultat_suppression_theme = $GLOBALS['projet_db']->query($requete_suppression_theme);
 
$requete_theme = '';
foreach ($tableau_de_valeur['projet_theme'] as $cle => $valeur) {
$requete_theme = 'insert into projet_avoir_theme set pat_id_projet='.$this->_db->escapeSimple($this->_id_projet).
', pat_id_theme='.$this->_db->escapeSimple($cle);
$resultat_theme = $GLOBALS['projet_db']->query($requete_theme);
if (DB::isError($resultat_theme)) {
return $resultat_theme->getMessage();
}
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Met a jour dans la base de donnee le champs p_nom_wikini
*
* @param int nom_wikini Le nouveau nom wikini
* @return bool
* @access public
*/
function majNomWikini( $nom_wikini )
{
$requete = 'update projet set p_wikini="'.$nom_wikini.'" where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function majNomWikini
 
function majSQLVisibilite($id_liste, $visible) {
 
$requete = 'UPDATE projet_liste set pl_visibilite='.$this->_db->escapeSimple($visible).' '.
'WHERE pl_id_liste ='.$id_liste;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return true;
}
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$msg = '' ;
// Supression du repertoire du projet
if (!$this->_suppression_repertoire()) {
$msg = 'La suppression du repertoire n\'a pas fonctionne' ;
}
// A ajouter la suppression des documents associes
 
// La suppression des evenements associés
 
// Le projet lui-meme
$requete = "delete from projet where p_id=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
 
if (PROJET_UTILISE_HIERARCHIE) {
$requete = "delete from projet_hierarchie where ph_id_projet_fils=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
}
$requete = "delete from projet_statut_utilisateurs where psu_id_projet=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
return $msg ;
} // end of member function suppressionSQL
 
/**
* Supprime le repertoire associe au projet (le repertoire doit etre vide).
*
* @return void
* @access private
*/
function _suppression_repertoire( )
{
return rmdir ($this->_chemin_repertoire.$this->_nom_repertoire) ;
} // end of member function _suppression_repertoire
 
/**
* Permet de creer le repertoire associe au projet.
*
* @param string nom_repertoire Le nom du répertoire à créer.
* @return boolean
* @access private
*/
function _creationRepertoire( $nom_repertoire )
{
return mkdir ($this->_chemin_repertoire.$nom_repertoire) ;
} // end of member function _creationRepertoire
 
/**
* Permet d'indiquer ou seront stockes les fichiers.
*
* @param string cheminRepertoire Le chemin jusqu'au repertoire ou seront stockes les fichiers.
* @return void
* @access public
*/
function setCheminRepertoire( $cheminRepertoire )
{
$this->_chemin_repertoire = $cheminRepertoire ;
} // end of member function setCheminRepertoire
 
/**
* Genere un nom de repertoire a partir de la premiere lettre de la chaine passe en
* parametre et de l'identifiant du dernier projet.
*
* @param string chaine Une chaine a partir de laquelle sera generer le nom du repertoire.
* @param DB objetDB un objet PEAR::DB
* @return string
* @static
* @access public
*/
function genereNomRepertoire( $chaine, &$objetDB )
{
$requete = "select p_id from projet order by p_id desc limit 0,1" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() > 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= $ligne->p_id + 1 ;
}
else {
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= 1 ;
}
return $nom ;
 
} // end of member function genereNomRepertoire
 
/**
* Permet de recuperer le nom du repertoire d'un projet.
*
* @return string
* @access public
*/
function getNomRepertoire( )
{
return $this->_nom_repertoire ;
} // end of member function getNomRepertoire
 
/**
* Ajoute une liste a un projet
* Effectue une insertion dans projet_lien_liste
*
* @param liste_discussion liste Une instance de la classe liste_discussion
* @return void
* @access public
*/
function ajouterListe( &$liste )
{
$requete = "insert into projet_lien_liste set pl_id_liste=".$this->_db->escapeSimple($liste->getId()).
', pl_id_projet='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
}
 
/**
* Supprime la liste de discussion associee au projet
*
* @return void
* @access public
*/
function supprimerListe(&$liste)
{
$requete = 'delete from projet_lien_liste where pl_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$requete = 'delete from projet_liste where pl_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
 
 
/**
* Renvoie vrai si le projet est racine.
*
* @return bool
* @access public
*/
function isRacine( )
{
return $this->_est_racine ;
} // end of member function isRacine
 
/**
* Renvoie le nombre d'inscrits au projet. Effectue une requete dans la table
* projet_statut_utilisateurs
*
* @return int
* @access public
*/
function getNombreInscrits( )
{
$requete = 'select count(psu_id_utilisateur) as nbre from projet_statut_utilisateurs where psu_id_projet='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->nbre ;
} // end of member function getNombreInscrits
 
 
/**
* Renvoie un tableau contenant les identifiants des fils du projet courant.
*
* @return Array
* @access public
*/
function getHierarchie( )
{
$requete = 'select ph_id_projet_fils from projet_hierarchie where ph_id_projet_pere='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->ph_id_projet_fils) ;
}
return $tableau_resultat ;
} // end of member function getHierarchie
 
/**
* Renvoie l'identifiant du pere du projet courrant.
*
* @return int
* @access public
*/
function getIdPere()
{
$requete = 'select ph_id_projet_pere from projet_hierarchie where ph_id_projet_fils='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->ph_id_projet_pere ;
} // end of member function getIdPere()
 
/**
* Renvoie le nom Wiki du wikini associe au projet.
*
* @return string
* @access public
*/
function getWikini( )
{
return $this->_nom_wikini ;
} // end of member function getWikini
 
/**
* Renvoie le type du projet, ou zero si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getType( )
{
return $this->_type ;
} // end of member function getType
 
/**
* Renvoie les themes du projet, ou zero si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getThemes( )
{
return $this->_themes ;
} // end of member function getType
 
/**
* Renvoie 1 si les inscriptions au projet sont moderees.
*
* @return int
* @access public
*/
function isModere( )
{
return $this->_isModere ;
} // end of member function getType
 
 
 
/**
* initAttributes sets all projet attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->chemin_wikini = "projet/wikini/";
}
 
 
} // end of projet
?>
/trunk/classes/enteteColonneTriable.class.php
1,259 → 1,259
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
// +------------------------------------------------------------------------------------------------------+
*/
 
 
 
/**
* class enteteColonneTriable
*/
class enteteColonneTriable
{
 
 
/*** Attributes: ***/
 
/**
* Nom de la colonne dont on veut afficher le lien
* @access private
*/
private $colonne;
 
/**
* Nom de la colonne dont on veut afficher le lien
* @access private
*/
private $var_colonneDeTri;
 
/**
* Nom de la colonne clique par l utilisateur
* @access private
*/
private $colonneCliquee;
 
/**
* @access private
*/
private $ordre = 'asc';
 
/**
* @access private
*/
private $var_ordre ;
/**
* @access private
*/
private $icone_asc;
 
/**
* @access private
*/
private $icone_desc;
 
/**
* icone par defaut lorsqu aucun tri n est demande
* @access private
*/
private $icone_base;
 
 
/**
*
* @param string nom_colonne Le nom de la colonne sur laquelle va s'effectuer les tris
 
* @return
* @access public
*/
public function enteteColonneTriable( $nom_colonne ) {
$this->colonne = $nom_colonne;
} // end of member function enteteColonneTriable
 
/**
*
* @param string colonneDeTri
* @return bool
* @access public
*/
public function setColonneCliquee( $colonneDeTri, $var_colonneDeTri ) {
$this->colonneCliquee = $colonneDeTri;
$this->var_colonneDeTri = $var_colonneDeTri;
} // end of member function setColonneCliquee
 
/**
* Precise l ordre ascendant ou descendant
* Ne peut prendre que 2 valeurs asc ou desc
*
* @param string ordre
* @return
* @access public
*/
public function setOrdre( $ordre, $var_ordre ) {
if ($ordre != 'asc' && $ordre != 'desc') return false;
//if ($this->colonne == $this->colonneCliquee) $this->ordre = $ordre;
// C subtil, il faut inverser l ordre de tri pour la colonne dont le tri est
// actif, afin de pouvoir inverser le tri
$this->ordre = $ordre;
if ($this->colonne == $this->colonneCliquee) {
if ($ordre == 'asc') $this->ordre = 'desc'; else $this->ordre = 'asc';
}
$this->var_ordre = $var_ordre;
} // end of member function setOrdre
 
/**
* Pour indiquer le chemin vers l icone de fleche vers le bas
* Renvoie false si le chemin vers l icone n existe pas
*
* @param string chemin_icone Le chemin vers l icone
 
* @return
* @access public
*/
public function setIconeAsc( $chemin_icone ) {
$this->icone_asc = $chemin_icone;
} // end of member function setIconeAsc
 
/**
* Pour indiquer le chemin vers l icone de fleche vers le bas
* Renvoie false si le chemin vers l icone n existe pas
*
* @param string chemin_icone Chemin vers l icone indiquant un classement descendant, en general une fleche
vers le haut
 
* @return bool
* @access public
*/
public function setIconeDesc( $chemin_icone ) {
$this->icone_desc = $chemin_icone;
} // end of member function setIconeDesc
 
/**
*
* @param string chemin_icone chemin vers un fichier
 
* @return bool
* @access public
*/
public function setIconeSansTri( $chemin_icone ) {
$this->icone_base = $chemin_icone;
} // end of member function setIconeSansTri
 
/**
* Permet d attribuer un template d affichage
*
* @param string template Permet d attribuer un template d affichage
 
* @return
* @access public
*/
public function setTemplate( $template ) {
} // end of member function setTemplate
 
/**
* Renvoie l icone approprie pour l entete de la colonne
*
* @return string
* @access public
*/
public function getIcone( ) {
if ($this->colonne == $this->colonneCliquee) {
if ($this->ordre == 'asc') {
return $this->icone_asc;
} else {
return $this->icone_desc;
}
} else {
return $this->icone_base;
}
} // end of member function getIcone
 
/**
* Renvoie la classe approprie pour l entete de la colonne
*
* @return string
* @access public
*/
public function getClasse( ) {
if ($this->colonne == $this->colonneCliquee) {
if ($this->ordre == 'asc') {
return 'tri_bas';
} else {
return 'tri_haut';
}
} else {
return 'tri_sans';
}
} // end of member function getIcone
/**
* Renvoie le lien de la colonne
*
* @return string
* @access public
*/
public function getLien($url) {
$url->addQueryString('projet_tri', $this->colonne);
$url->addQueryString('projet_ordre_tri', $this->ordre);
return $url->getURL();
} // end of member function getLien
 
/**
* Renvoie l entete
*
* @return string
* @access public
*/
public function getEntete( ) {
} // end of member function getEntete
 
/**
* similaire a getEntete()
*
* @return string
* @access public
*/
public function toHTML( ) {
return getEntete();
} // end of member function toHTML
 
 
 
 
 
} // end of enteteColonneTriable
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: enteteColonneTriable.class.php,v 1.1 2008-08-25 15:17:13 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
// +------------------------------------------------------------------------------------------------------+
*/
 
 
 
/**
* class enteteColonneTriable
*/
class enteteColonneTriable
{
 
 
/*** Attributes: ***/
 
/**
* Nom de la colonne dont on veut afficher le lien
* @access private
*/
private $colonne;
 
/**
* Nom de la colonne dont on veut afficher le lien
* @access private
*/
private $var_colonneDeTri;
 
/**
* Nom de la colonne clique par l utilisateur
* @access private
*/
private $colonneCliquee;
 
/**
* @access private
*/
private $ordre = 'asc';
 
/**
* @access private
*/
private $var_ordre ;
/**
* @access private
*/
private $icone_asc;
 
/**
* @access private
*/
private $icone_desc;
 
/**
* icone par defaut lorsqu aucun tri n est demande
* @access private
*/
private $icone_base;
 
 
/**
*
* @param string nom_colonne Le nom de la colonne sur laquelle va s'effectuer les tris
 
* @return
* @access public
*/
public function enteteColonneTriable( $nom_colonne ) {
$this->colonne = $nom_colonne;
} // end of member function enteteColonneTriable
 
/**
*
* @param string colonneDeTri
* @return bool
* @access public
*/
public function setColonneCliquee( $colonneDeTri, $var_colonneDeTri ) {
$this->colonneCliquee = $colonneDeTri;
$this->var_colonneDeTri = $var_colonneDeTri;
} // end of member function setColonneCliquee
 
/**
* Precise l ordre ascendant ou descendant
* Ne peut prendre que 2 valeurs asc ou desc
*
* @param string ordre
* @return
* @access public
*/
public function setOrdre( $ordre, $var_ordre ) {
if ($ordre != 'asc' && $ordre != 'desc') return false;
//if ($this->colonne == $this->colonneCliquee) $this->ordre = $ordre;
// C subtil, il faut inverser l ordre de tri pour la colonne dont le tri est
// actif, afin de pouvoir inverser le tri
$this->ordre = $ordre;
if ($this->colonne == $this->colonneCliquee) {
if ($ordre == 'asc') $this->ordre = 'desc'; else $this->ordre = 'asc';
}
$this->var_ordre = $var_ordre;
} // end of member function setOrdre
 
/**
* Pour indiquer le chemin vers l icone de fleche vers le bas
* Renvoie false si le chemin vers l icone n existe pas
*
* @param string chemin_icone Le chemin vers l icone
 
* @return
* @access public
*/
public function setIconeAsc( $chemin_icone ) {
$this->icone_asc = $chemin_icone;
} // end of member function setIconeAsc
 
/**
* Pour indiquer le chemin vers l icone de fleche vers le bas
* Renvoie false si le chemin vers l icone n existe pas
*
* @param string chemin_icone Chemin vers l icone indiquant un classement descendant, en general une fleche
vers le haut
 
* @return bool
* @access public
*/
public function setIconeDesc( $chemin_icone ) {
$this->icone_desc = $chemin_icone;
} // end of member function setIconeDesc
 
/**
*
* @param string chemin_icone chemin vers un fichier
 
* @return bool
* @access public
*/
public function setIconeSansTri( $chemin_icone ) {
$this->icone_base = $chemin_icone;
} // end of member function setIconeSansTri
 
/**
* Permet d attribuer un template d affichage
*
* @param string template Permet d attribuer un template d affichage
 
* @return
* @access public
*/
public function setTemplate( $template ) {
} // end of member function setTemplate
 
/**
* Renvoie l icone approprie pour l entete de la colonne
*
* @return string
* @access public
*/
public function getIcone( ) {
if ($this->colonne == $this->colonneCliquee) {
if ($this->ordre == 'asc') {
return $this->icone_asc;
} else {
return $this->icone_desc;
}
} else {
return $this->icone_base;
}
} // end of member function getIcone
 
/**
* Renvoie la classe approprie pour l entete de la colonne
*
* @return string
* @access public
*/
public function getClasse( ) {
if ($this->colonne == $this->colonneCliquee) {
if ($this->ordre == 'asc') {
return 'tri_bas';
} else {
return 'tri_haut';
}
} else {
return 'tri_sans';
}
} // end of member function getIcone
/**
* Renvoie le lien de la colonne
*
* @return string
* @access public
*/
public function getLien($url) {
$url->addQueryString('projet_tri', $this->colonne);
$url->addQueryString('projet_ordre_tri', $this->ordre);
return $url->getURL();
} // end of member function getLien
 
/**
* Renvoie l entete
*
* @return string
* @access public
*/
public function getEntete( ) {
} // end of member function getEntete
 
/**
* similaire a getEntete()
*
* @return string
* @access public
*/
public function toHTML( ) {
return getEntete();
} // end of member function toHTML
 
 
 
 
 
} // end of enteteColonneTriable
?>
/trunk/classes/fichier.class.php
1,293 → 1,293
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier.class.php,v 1.7 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* La classe fichier
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class fichier
* Cette classe représente un fichier au sens physique du terme. Elle fonctionne
* pour les système UNIX. A faire : adaptation selon les système. L'objectif est de
* gérer correctement l'upload de fichier.
*/
class fichier
{
/*** Attributes: ***/
/**
* Le nom du fichier, avec son extension.
* @access private
*/
var $_nom;
/**
* Le chemin UNIX ou Windows pour accéder au fichier sur le serveur (par ex;
* /var/www/fichier.txt
* @access private
*/
var $_chemin;
/**
* Cet attribut contient une valeur du type 755, indiquant les droits afférent à un
* fichier selon le système UNIX (propriétaire, groupe, autres)
* @access private
*/
var $_droits_unix;
/**
* Le type indique si le fichier est un répertoire, un lien ou un fichier.
* @access private
*/
var $_type = 'fichier';
/**
* l'identifiant du type mime.
* @access private
*/
var $_type_mime;
/**
* Le chemin vers le fichier, en partant du répertoire de travail.
* @access private
*/
var $_prefixe_chemin;
 
/**
*
*
* @return void
* @access public
*/
function fichier( $chemin, &$objetDB)
{
$this->_chemin = $chemin ;
// On analyse l'extension pour découvrir le type mime
$partie_chemin = pathinfo ($this->_chemin) ;
if (is_object($objetDB) && isset($partie_chemin['extension'])) {
$this->_type_mime = type_fichier_mime::factory ($partie_chemin['extension']) ;
}
// calcul du type
if (is_dir ($this->_chemin)) $this->_type = 'repertoire' ;
} // end of member function fichier
 
/**
* Le constructeur de la classe.
*
* @param string chemin Le chemin du fichier sur le serveur.
* @return fichier
* @access public
*/
function __construct( $chemin, &$objetDB)
{
$this->fichier($chemin, $objetDB);
} // end of member function __construct
 
/**
*
*
* @return void
* @access public
*/
function suppression()
{
if ($this->_type == 'repertoire') rmdir ($this->_chemin) ;
if ($this->_type == 'fichier') unlink ($this->_chemin) ;
} // end of member function suppression
 
/**
* Réalise l'upload d'un fichier vers chemin_destination.
*
* @param string chemin_destination Il s'agit du chemin UNIX de destination du fichier. Le script doit avoir les
* droits en écriture sur le répertoire.
* @global mixed une référence vers un objet HTML_QuickForm_File
* @return void
* @access public
*/
function upload( $chemin_destination )
{
if (move_uploaded_file($_FILES['fichier']['tmp_name'], $chemin_destination)) {
return true ;
} else {
return false ;
}
} // end of member function upload
 
/**
* Déplace un fichier, renvoie vrai en cas de succès.
*
* @param string origine L'emplacement de départ du fichier.
* @param string destination Le répertoire d'arrivé.
* @return bool
* @access public
*/
function deplace( $origine, $destination )
{
if (rename ($origine, $destination )) return true ;
return false ;
} // end of member function deplace
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime du document.
* @return type_fichier_mime
* @access public
*/
function getTypeMime( )
{
return $this->_type_mime;
} // end of member function getTypeMime
 
/**
* Renvoie vrai si le document est un répertoire.
*
* @return bool
* @access public
*/
function isRepertoire( )
{ $isRep = is_dir ($this->_chemin) ;
return $isRep ;
} // end of member function isRepertoire
 
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime.
* @return void
* @access public
*/
function setTypeMime( $id_type_mime )
{
$this->_type_mime = $id_type_mime ;
} // end of member function set TypeMime
 
 
/**
* Renvoie la taille du fichier en octet. Nécessite un accès au disque.
*
* @return int
* @access public
*/
function getTaille( )
{
if ($this->isRepertoire()) {
return $this->_tailleRepertoire($this->_chemin) ;
}
return @filesize ($this->_chemin) ;
} // end of member function getTaille
 
/**
* Renovie le nom du fichier, sur le disque.
*
* @return string
* @access public
*/
function getNom( )
{
} // end of member function getNom
 
/**
* Renvoie le chemin du fichier.
*
* @return string
* @access public
*/
function getChemin( )
{
return $this->_chemin ;
} // end of member function getChemin
 
/**
* Permet de calculer la taille en octet du repertoire courrant
*
* @return int
* @access protected
*/
function _tailleRepertoire($rep)
{
$taille = 0 ;
$liste_fichier = scandir ($rep) ;
foreach ($liste_fichier as $key => $value) {
if (is_dir ($rep."/".$value) && $value != ".." && $value != ".") {
$taille += $this->_tailleRepertoire ($rep.$value."/") ;
} else {
if ($value != '..' && $value != '.') $taille += @filesize ($rep.$value) ;
}
}
return $taille ;
} // end of member function _tailleRepertoire
 
 
/**
* initAttributes sets all fichier attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_type = 'fichier';
}
 
 
} // end of fichier
 
if(!function_exists("scandir"))
{
function scandir($dirstr)
{
// php.net/scandir (PHP5)
$files = array();
$fh = opendir($dirstr);
while (false !== ($filename = readdir($fh)))
{
array_push($files, $filename);
}
closedir($fh);
return $files;
}
}
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier.class.php,v 1.8 2008-08-25 15:16:25 alexandre_tb Exp $
/**
* Application projet
*
* La classe fichier
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class fichier
* Cette classe représente un fichier au sens physique du terme. Elle fonctionne
* pour les système UNIX. A faire : adaptation selon les système. L'objectif est de
* gérer correctement l'upload de fichier.
*/
class fichier
{
/*** Attributes: ***/
/**
* Le nom du fichier, avec son extension.
* @access private
*/
var $_nom;
/**
* Le chemin UNIX ou Windows pour accéder au fichier sur le serveur (par ex;
* /var/www/fichier.txt
* @access private
*/
var $_chemin;
/**
* Cet attribut contient une valeur du type 755, indiquant les droits afférent à un
* fichier selon le système UNIX (propriétaire, groupe, autres)
* @access private
*/
var $_droits_unix;
/**
* Le type indique si le fichier est un répertoire, un lien ou un fichier.
* @access private
*/
var $_type = 'fichier';
/**
* l'identifiant du type mime.
* @access private
*/
var $_type_mime;
/**
* Le chemin vers le fichier, en partant du répertoire de travail.
* @access private
*/
var $_prefixe_chemin;
 
/**
*
*
* @return void
* @access public
*/
function fichier( $chemin, &$objetDB)
{
$this->_chemin = $chemin ;
// On analyse l'extension pour découvrir le type mime
$partie_chemin = pathinfo ($this->_chemin) ;
if (is_object($objetDB) && isset($partie_chemin['extension'])) {
$this->_type_mime = type_fichier_mime::factory ($partie_chemin['extension']) ;
}
// calcul du type
if (is_dir ($this->_chemin)) $this->_type = 'repertoire' ;
} // end of member function fichier
 
/**
* Le constructeur de la classe.
*
* @param string chemin Le chemin du fichier sur le serveur.
* @return fichier
* @access public
*/
function __construct( $chemin, &$objetDB)
{
$this->fichier($chemin, $objetDB);
} // end of member function __construct
 
/**
*
*
* @return void
* @access public
*/
function suppression()
{
if ($this->_type == 'repertoire') rmdir ($this->_chemin) ;
if ($this->_type == 'fichier') unlink ($this->_chemin) ;
} // end of member function suppression
 
/**
* Réalise l'upload d'un fichier vers chemin_destination.
*
* @param string chemin_destination Il s'agit du chemin UNIX de destination du fichier. Le script doit avoir les
* droits en écriture sur le répertoire.
* @global mixed une référence vers un objet HTML_QuickForm_File
* @return void
* @access public
*/
function upload( $chemin_destination )
{
if (move_uploaded_file($_FILES['fichier']['tmp_name'], $chemin_destination)) {
return true ;
} else {
return false ;
}
} // end of member function upload
 
/**
* Déplace un fichier, renvoie vrai en cas de succès.
*
* @param string origine L'emplacement de départ du fichier.
* @param string destination Le répertoire d'arrivé.
* @return bool
* @access public
*/
function deplace( $origine, $destination )
{
if (rename ($origine, $destination )) return true ;
return false ;
} // end of member function deplace
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime du document.
* @return type_fichier_mime
* @access public
*/
function getTypeMime( )
{
return $this->_type_mime;
} // end of member function getTypeMime
 
/**
* Renvoie vrai si le document est un répertoire.
*
* @return bool
* @access public
*/
function isRepertoire( )
{ $isRep = is_dir ($this->_chemin) ;
return $isRep ;
} // end of member function isRepertoire
 
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime.
* @return void
* @access public
*/
function setTypeMime( $id_type_mime )
{
$this->_type_mime = $id_type_mime ;
} // end of member function set TypeMime
 
 
/**
* Renvoie la taille du fichier en octet. Nécessite un accès au disque.
*
* @return int
* @access public
*/
function getTaille( )
{
if ($this->isRepertoire()) {
return $this->_tailleRepertoire($this->_chemin) ;
}
return @filesize ($this->_chemin) ;
} // end of member function getTaille
 
/**
* Renovie le nom du fichier, sur le disque.
*
* @return string
* @access public
*/
function getNom( )
{
} // end of member function getNom
 
/**
* Renvoie le chemin du fichier.
*
* @return string
* @access public
*/
function getChemin( )
{
return $this->_chemin ;
} // end of member function getChemin
 
/**
* Permet de calculer la taille en octet du repertoire courrant
*
* @return int
* @access protected
*/
function _tailleRepertoire($rep)
{
$taille = 0 ;
$liste_fichier = scandir ($rep) ;
foreach ($liste_fichier as $key => $value) {
if (is_dir ($rep."/".$value) && $value != ".." && $value != ".") {
$taille += $this->_tailleRepertoire ($rep.$value."/") ;
} else {
if ($value != '..' && $value != '.') $taille += @filesize ($rep.$value) ;
}
}
return $taille ;
} // end of member function _tailleRepertoire
 
 
/**
* initAttributes sets all fichier attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_type = 'fichier';
}
 
 
} // end of fichier
 
if(!function_exists("scandir"))
{
function scandir($dirstr)
{
// php.net/scandir (PHP5)
$files = array();
$fh = opendir($dirstr);
while (false !== ($filename = readdir($fh)))
{
array_push($files, $filename);
}
closedir($fh);
return $files;
}
}
?>
/trunk/classes/liste_externe.class.php
1,162 → 1,166
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_externe.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe liste_externe
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class liste_externe
*
*/
class liste_externe
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste, dans la table agora et dans la table
* projet_lien_liste_externe
* @access private
*/
var $_id_liste;
/**
*
* @access private
*/
var $_db;
/**
* Constructeur
*
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function liste_externe(&$objetDB )
{
$this->_db = $objetDB ;
} // end of member function liste_externe
 
/**
* Renvoie un tableau avec en clé l'identifiant d'une liste et en valeur le nom de
* la liste.
*
* @return Array
* @access public
*/
function getListeNom( )
{
$requete = 'select AGO_A_ID, AGO_A_NOMGRPLG from agora' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tableau_resultat[$ligne['AGO_A_ID']] = $ligne['AGO_A_NOMGRPLG'] ;
}
return $tableau_resultat ;
} // end of member function getListeNom
 
/**
* Renvoie un tableau avec les identifiants des listes associées au projet passé en
* paramètre.
*
* @param int id_projet L'identifiant du projet
* @return Array
* @access public
*/
function getListesAssociees( $id_projet )
{
$requete = 'select plle_id_liste from projet_lien_liste_externe where plle_id_projet='.$this->_db->escapeSimple($id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->plle_id_liste) ;
}
return $tableau_resultat ;
} // end of member function getListesAssociees
 
/**
* enregistrerSQL
*
* @return
*/
function enregistrerSQL ($valeur, $id_projet) {
// on commence par supprimer
$requete = 'delete from projet_lien_liste_externe where plle_id_projet='.$this->_db->escapeSimple($id_projet) ;
$resultat = $this->_db->query ($requete) ;
// puis on réinsère
foreach ($valeur as $cle => $val) {
if (!preg_match ('/liste_/', $cle)) continue ;
$id_liste = preg_replace ('/liste_/', '', $cle) ;
$requete = 'insert into projet_lien_liste_externe set plle_id_liste='.$this->_db->escapeSimple($id_liste).', plle_id_projet='.$this->_db->escapeSimple($id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
}
 
/**
* Renvoie un tableau avec les infos sur la liste, voir les noms des champs de la
* table agora pour une description plus détaillé.
*
* @param int id_liste L'identifiant de la liste
* @return void
* @access public
*/
function getInfoListe( $id_liste )
{
$requete = 'select * from agora where AGO_A_ID='.$this->_db->escapeSimple($id_liste) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne ;
} // end of member function getInfoListe
 
} // end of liste_externe
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_externe.class.php,v 1.3 2008-09-16 14:12:04 alexandre_tb Exp $
/**
* Application projet
*
* La classe liste_externe
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class liste_externe
*
*/
class liste_externe
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste, dans la table agora et dans la table
* projet_lien_liste_externe
* @access private
*/
var $_id_liste;
/**
*
* @access private
*/
var $_db;
/**
* Constructeur
*
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function liste_externe(&$objetDB )
{
$this->_db = $objetDB ;
} // end of member function liste_externe
 
/**
* Renvoie un tableau avec en clé l'identifiant d'une liste et en valeur le nom de
* la liste.
*
* @return Array
* @access public
*/
function getListeNom( )
{
$requete = 'select AGO_A_ID, AGO_A_NOMGRPLG from agora' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tableau_resultat[$ligne['AGO_A_ID']] = $ligne['AGO_A_NOMGRPLG'] ;
}
return $tableau_resultat ;
} // end of member function getListeNom
 
/**
* Renvoie un tableau avec les identifiants des listes associées au projet passé en
* paramètre.
*
* @param int id_projet L'identifiant du projet
* @return Array
* @access public
*/
function getListesAssociees( $id_projet )
{
if(!intval($id_projet)) return NULL;
$requete = sprintf('SELECT plle_id_liste FROM projet_lien_liste_externe WHERE plle_id_projet=%d -- %s',
intval($id_projet),
__FILE__ . ':' . __LINE__);
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->plle_id_liste) ;
}
return $tableau_resultat ;
} // end of member function getListesAssociees
 
/**
* enregistrerSQL
*
* @return
*/
function enregistrerSQL ($valeur, $id_projet) {
// on commence par supprimer
$requete = 'delete from projet_lien_liste_externe where plle_id_projet='.intval($id_projet) ;
$resultat = $this->_db->query ($requete) ;
// puis on réinsère
foreach ($valeur as $cle => $val) {
if (!preg_match ('/liste_/', $cle)) continue ;
$id_liste = preg_replace ('/liste_/', '', $cle) ;
$requete = 'insert into projet_lien_liste_externe set plle_id_liste='.$this->_db->escapeSimple($id_liste).
', plle_id_projet='.inval($id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
}
 
/**
* Renvoie un tableau avec les infos sur la liste, voir les noms des champs de la
* table agora pour une description plus détaillé.
*
* @param int id_liste L'identifiant de la liste
* @return void
* @access public
*/
function getInfoListe( $id_liste )
{
$requete = 'select * from agora where AGO_A_ID='.$this->_db->escapeSimple($id_liste) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne ;
} // end of member function getInfoListe
 
} // end of liste_externe
?>
/trunk/classes/document.class.php
1,675 → 1,665
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: document.class.php,v 1.9 2008-08-25 15:18:10 alexandre_tb Exp $
/**
* Application projet
*
* La classe document
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'fichier.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class document
* Représente un document associé à un projet. C'est à dire un fichier
* téléchargeable disposant en plus d'une visibilité, d'un nom long, d'une
* description et d'une url.
*/
class document extends fichier
{
/*** Attributes: ***/
 
/**
* Description qui apparaitra à l'écran.
* @access private
*/
var $_description;
/**
* Date de dernière mise à jour des attributs du fichier.
* @access private
*/
var $_date_mise_a_jour;
/**
* Soit public, soit privé.
* @access private
*/
var $_visibilite;
/**
* Le nom du fichier tel qu'il apparaitra à l'écran.
* @access private
*/
var $_nom_long;
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du document dans la table projet_document.
* @access private
*/
var $_id;
 
/**
*
* @access private
*/
var $_chemin_icone;
/**
* L'identifiant du père, peut être à NULL
* @access private
*/
var $_id_pere;
/**
* L'identifiant du propriétaire. Provient d'un annuaire. Peut être à NULL.
* @access private
*/
var $_id_proprietaire;
/**
* L'identifiant du projet auquel appartient le document. Peut être à NULL.
* @access private
*/
var $_id_projet;
 
/**
* Le chemin du fichier, depuis le répertoire du projet
*
*/
var $_pd_lien ;
var $nom_fichier ;
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB un objet PEAR:DB
* @return void
* @access public
*/
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
{
if (is_object($objetDB)) {
$GLOBALS['projet_db'] = $objetDB;
}
$this->_chemin_icone = $chemin_icones ;
if ($id_document != "") {
$requete = "select * from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows()>0) {
$this->nom_fichier = $ligne->pd_lien;
$this->_id_projet = $ligne->pd_ce_projet;
$this->_id = $ligne->pd_id ;
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
$this->_nom_long = $ligne->pd_nom ;
$this->_visibilite = $ligne->pd_visibilite ;
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
$this->_description = $ligne->pd_description ;
$this->_pd_lien = $ligne->pd_lien;
if ($this->_isRacine($ligne->pd_pere)) {
$this->_id_pere = 0 ;
} else {
$this->_id_pere = $ligne->pd_pere ;
}
}
}
} // end of member function document
 
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB Un objet PEAR:DB
* @return document
* @access public
*/
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
{
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
} // end of member function __construct
 
 
/**
* Renvoie le nom long du fichier.
*
* @return string
* @access public
*/
function getNomLong( )
{
return $this->_nom_long ;
} // end of member function getNomLong
 
/**
* Renvoie la visibilité du document, soit "public" soit "prive"
*
* @return visibilite
* @access public
*/
function getVisibilite( )
{
return $this->_visibilite ;
} // end of member function getVisibilite
 
/**
* Renvoie la description du document, sous forme de chaine.
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description ;
} // end of member function getDescription
 
/**
* Renvoie la date de création ou de mise à jour du fichier.
*
* @return date
* @access public
*/
function getDateMiseAJour( )
{
return $this->_date_mise_a_jour ;
} // end of member function getDateMiseAJour
 
/**
* Renvoie l'identifiant d'un document.
*
* @return int
* @access public
*/
function getIdDocument( )
{
return $this->_id ;
} // end of member function getIdDocument
 
/**
* Renvoie le chemin de l'icone du fichier. Fait un appel à type_fichier_mime.
*
* @return string
* @access public
*/
function getCheminIcone()
{
if ($this->isRepertoire()) {
return $this->_chemin_icone."repertoire.gif" ;
} else {
if (is_object ($this->_type_mime)) return $this->_type_mime->getCheminIcone() ;
}
} // end of member function getCheminIcone
 
/**
* Permet de récupérer le nom du répertoire racine associé à un projet.
*
* @param int id_projet L'identifiant du projet dont on veux récupérer le répertoire racine.
* @param DB objetDB Un objet PEAR:DB
* @return string
* @static
* @access public
*/
function getNomRepertoireProjet( $id_projet , &$objetDB)
{
// Dans la table projet_documents, pour les répertoires racines, pd_pere = null
$requete = "select pd_nom from projet_documents where pd_ce_projet=".$GLOBALS['projet_db']->escapeSimple($id_projet)." and pd_pere is null" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pd_nom ;
} // end of member function getNomRepertoireProjet
 
 
/**
* Renvoie true si le document passé en paramètre est le répertoire racine.
*
* @param int id_document L'identifiant du document dont on veut savoir si c'est la racine.
* @return bool
* @access public
*/
function _isRacine( $id_document )
{
if ($id_document) {
$requete = "select pd_pere from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows() >0) {
if ($ligne->pd_pere == null){
return true ;
}
}
}
return false ;
} // end of member function _isRacine
 
/**
* Renvoie le chemin d'un fichier ou d'un répertoire. Contrairement à la classe
* mère, cette méthode renvoie une URL projet et non pas un fichier.
*
* @return string
* @access public
*/
function getChemin($prefixe = '')
{
$chemin_repertoire_entre_racine_et_fichier = '';
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
// l arborescence des repertoires
$tableau_navigation = $this->getPath($this->_id) ;
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
for ($i = 0; $i < count ($tableau_navigation); $i++) {
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
}
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
}
 
 
/**
* Renvoie pour le repertoire ou le fichier courant, les identifiants et les noms de tous les
* répertoires père jusqu'à la racine. 0 => ['id'], ['nom'] 1 => [id'], ['nom'] etc.
* En commençant par la racine et en descendant. Pour la racine id vaut "" et nom
* vaut "".
*
* @param int id_repertoire L'identifiant d'un répertoire.
* @return Array
* @access public
*/
function getCheminIdRepertoire( $id_doc, &$objetDB )
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($id_doc) ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0) {
if ($ligne->pd_pere == 0) {
return array ($ligne->pd_id);
}
array_push ($chemin_rep_id_nom, $ligne->pd_id) ;
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
}
return ($chemin_rep_id_nom);
}
function getPath( $id_doc)
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($id_doc) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0 && $ligne->pd_pere != 0 && $ligne->pd_pere != $ligne->pd_id) {
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
// Récursion sur le répertoires ou fichiers fils
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
}
return $chemin_rep_id_nom;
}
/**
* Calcule le chemin vers le fichier ou le répertoire uploadé
* renvoie un chaine de la forme dir1/dir2/fichier.ext
* En prenant comme racine le répertoire du projet, exclu.
* @return string Le chemin
*/
 
function calculeCheminUploaded ($radical) {
 
if (isset($_FILES['fichier']['name'])) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
}
 
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$doc_pere = new document ($this->_id_pere, $GLOBALS['projet_db']);
return $doc_pere->getChemin();
$tableau_navigation = $this->getPath($this->_id_pere) ;
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
} else {
// Si l'on est à la racine du projet, le chemin vide
return $radical ;
}
return $chemin ;
}
 
/**
* Enregistre une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur, $chemin) {
// On teste si on a affaire à un répertoire ou un fichier
if (isset ($_FILES['fichier']['name'])) {
// On tente de déterminer le type du fichier à partir de son nom dans $valeur['$fichier']
$tableau_nom = explode (".", $_FILES['fichier']['name']) ;
// On prend le dernier élément du tableau, si c'est un tableau
if (is_array($tableau_nom)) {
$extension = array_pop($tableau_nom) ;
$type = type_fichier_mime::factory($extension) ;
$id_extension = $type->getIdType() ;
} else {
$id_extension = 12 ;
}
$pd_lien = $chemin ;
} else { // Le cas ou on a affaire à un répertoire
$id_extension = 0 ;
// Le nom du répertoire est son identifiant avec un slash à la fin
$pd_lien = $chemin."/" ;
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $GLOBALS['projet_db']) ;
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$pd_lien .= $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
}
//$pd_lien .= SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
$pd_lien = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
}
$id = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id') ;
 
$requete = "insert into projet_documents set pd_id=".$GLOBALS['projet_db']->escapeSimple($id) ;
$requete .= ", pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW(),".
"pd_ce_projet=\"".$this->_id_projet."\", pd_ce_utilisateur=\"".$this->_id_proprietaire."\"".
", pd_pere=\"$this->_id_pere\", pd_ce_type=\"$id_extension\", pd_lien=\"$pd_lien\"" ;
 
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
return $pd_lien;
}
 
function genereNouveauNom ($radical, $ancien_nom, $id) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $ancien_nom) ;
$nouveau_nom = $radical."_".$id.".".$extension ;
return $nouveau_nom;
}
 
/**
* Met à jour une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function majSQL ($valeur) {
$requete = "update projet_documents set pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW()".
" where pd_id=".$GLOBALS['projet_db']->escapeSimple($this->_id);
 
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return ;
}
 
/** Supprime les donnéexs du document dans la table projet_documents
*
*
* @return true en cas de succès
*/
function suppressionSQL () {
$requete = 'delete from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($this->_id) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if ($GLOBALS['projet_db']->affectedRows()) return true ;
return false ;
}
/**
* Déplace un document au sein d'un même projet
*
* @param int repertoire_destination L'identifiant du répertoire destination.
* @return bool
* @access public
*/
function deplace( $repertoire_destination, $repertoire_projet )
{
 
// On récupère les informations du répertoire cible
if ($repertoire_destination != 0) {
$repertoire_cible = new document ($repertoire_destination, $GLOBALS['projet_db']) ;
$chemin_rep_cible = $repertoire_cible->getChemin();
} else {
// Si le repertoire destination est la racine cad id =0
// on cree un document qui aura pour chemin le repertoire du projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
$chemin_rep_cible = $projet->getNomRepertoire().'/';
}
$nom_fichier = $this->_pd_lien ;
$requete = 'update projet_documents set pd_pere='.$GLOBALS['projet_db']->escapeSimple($repertoire_destination).' where pd_id='.$GLOBALS['projet_db']->escapeSimple($this->_id) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
return false ;
}
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier) ;
} // end of member function deplace
 
 
/**
* Pour modifier l'identifiant du projet auquel appartient un document.
*
* @param int id_projet L'identifiant du projet.
* @return void
* @access public
*/
function setIdProjet( $id_projet )
{
$this->_id_projet = $id_projet ;
} // end of member function setIdProjet
 
/**
* Permet de modifier l'identifiant du propietaire d'un projet.
*
* @param int id_proprietaire L'identifiant du proprietaire d'un document.
* @return void
* @access public
*/
function setIdProprietaire( $id_proprietaire )
{
$this->_id_proprietaire = $id_proprietaire ;
} // end of member function setIdProprietaire
 
/**
* Permet de modifier l'identifiant du répertoire d'un document.
*
* @param int id_repertoire L'identifiant du repertoire d'un document.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_pere = $id_repertoire;
} // end of member function setIdRepertoire
 
/**
* initAttributes sets all document attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_visibilite = "public";
}
 
/**
* Renvoie les derniers documents de l'ensemble des projets.
*
* @param int nombre Le nombre de document à renvoyer
* @return Array
* @static
* @access public
*/
static function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
{
// on recherche les documents, hors repertoire
$requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
if ($id_projet != '') $requete .= ' and pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_projet).' ';
if (!$visible) $requete .= ' and pd_visibilite="public" ';
$requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_document = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
} // end of member function getDocumentsRecents
 
/**
* Renvoie les documents du projet passe en parametre sous forme d arbre d objet document
*
* @param int l identifiant du projet
* @return Array
* @static
* @access public
*/
function getArbreDocument($id_projet, $objetDB = '') {
$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_projet);
$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return $resultat;
}
/**
* Renvoie la taille du document formatee avec une unite adapte
*
* @return string La taille formate
* @access public
*/
function getTailleFormatee($precision = 1) {
$taille = $this->getTaille();
if ($taille > 1000000) {
$diviseur = 1000000;
$unite = 'Mo';
} else {
$diviseur = 1000 ;
$unite = 'Ko';
}
return round ($taille / $diviseur, $precision).'&nbsp;'.$unite;
}
/**
* Renvoie une liste de document, enfant du document courant
* qui doit etre un repertoire bien sur
*
* @return mixed un tableau de document
* @access public
*/
function getDocumentsEnfant() {
}
} // end of document
 
 
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: document.class.php,v 1.10 2008-08-26 12:41:10 alexandre_tb Exp $
/**
* Application projet
*
* La classe document
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.10 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'fichier.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class document
* Représente un document associé à un projet. C'est à dire un fichier
* téléchargeable disposant en plus d'une visibilité, d'un nom long, d'une
* description et d'une url.
*/
class document extends fichier
{
/*** Attributes: ***/
 
/**
* Description qui apparaitra à l'écran.
* @access private
*/
var $_description;
/**
* Date de dernière mise à jour des attributs du fichier.
* @access private
*/
var $_date_mise_a_jour;
/**
* Soit public, soit privé.
* @access private
*/
var $_visibilite;
/**
* Le nom du fichier tel qu'il apparaitra à l'écran.
* @access private
*/
var $_nom_long;
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
 
/**
* L'identifiant du document dans la table projet_document.
* @access private
*/
var $_id;
 
/**
*
* @access private
*/
var $_chemin_icone;
 
/**
* L'identifiant du père, peut être à NULL
* @access private
*/
var $_id_pere;
 
/**
* L'identifiant du propriétaire. Provient d'un annuaire. Peut être à NULL.
* @access private
*/
var $_id_proprietaire;
/**
* L'identifiant du projet auquel appartient le document. Peut être à NULL.
* @access private
*/
var $_id_projet;
 
/**
* Le chemin du fichier, depuis le répertoire du projet
*
*/
var $_pd_lien ;
 
var $nom_fichier ;
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB un objet PEAR:DB
* @return void
* @access public
*/
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
{
if (is_object($objetDB)) {
$GLOBALS['projet_db'] = $objetDB;
}
$this->_chemin_icone = $chemin_icones ;
if ($id_document != "") {
$requete = "select * from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows()>0) {
$this->nom_fichier = $ligne->pd_lien;
$this->_id_projet = $ligne->pd_ce_projet;
$this->_id = $ligne->pd_id ;
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
 
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
$this->_nom_long = $ligne->pd_nom ;
$this->_visibilite = $ligne->pd_visibilite ;
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
$this->_description = $ligne->pd_description ;
$this->_pd_lien = $ligne->pd_lien;
 
if ($this->_isRacine($ligne->pd_pere)) {
$this->_id_pere = 0 ;
} else {
$this->_id_pere = $ligne->pd_pere ;
}
}
}
 
} // end of member function document
 
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB Un objet PEAR:DB
* @return document
* @access public
*/
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
{
 
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
 
} // end of member function __construct
 
 
/**
* Renvoie le nom long du fichier.
*
* @return string
* @access public
*/
function getNomLong( )
{
return $this->_nom_long ;
} // end of member function getNomLong
 
/**
* Renvoie la visibilité du document, soit "public" soit "prive"
*
* @return visibilite
* @access public
*/
function getVisibilite( )
{
return $this->_visibilite ;
} // end of member function getVisibilite
 
/**
* Renvoie la description du document, sous forme de chaine.
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description ;
} // end of member function getDescription
 
/**
* Renvoie la date de création ou de mise à jour du fichier.
*
* @return date
* @access public
*/
function getDateMiseAJour( )
{
return $this->_date_mise_a_jour ;
} // end of member function getDateMiseAJour
 
/**
* Renvoie l'identifiant d'un document.
*
* @return int
* @access public
*/
function getIdDocument( )
{
return $this->_id ;
} // end of member function getIdDocument
 
/**
* Renvoie le chemin de l'icone du fichier. Fait un appel à type_fichier_mime.
*
* @return string
* @access public
*/
function getCheminIcone()
{
if ($this->isRepertoire()) {
return $this->_chemin_icone."repertoire.gif" ;
} else {
if (is_object ($this->_type_mime)) return $this->_type_mime->getCheminIcone() ;
}
} // end of member function getCheminIcone
 
/**
* Permet de récupérer le nom du répertoire racine associé à un projet.
*
* @param int id_projet L'identifiant du projet dont on veux récupérer le répertoire racine.
* @param DB objetDB Un objet PEAR:DB
* @return string
* @static
* @access public
*/
function getNomRepertoireProjet( $id_projet , &$objetDB)
{
// Dans la table projet_documents, pour les répertoires racines, pd_pere = null
$requete = "select pd_nom from projet_documents where pd_ce_projet=".$GLOBALS['projet_db']->escapeSimple($id_projet)." and pd_pere is null" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pd_nom ;
} // end of member function getNomRepertoireProjet
 
 
/**
* Renvoie true si le document passé en paramètre est le répertoire racine.
*
* @param int id_document L'identifiant du document dont on veut savoir si c'est la racine.
* @return bool
* @access public
*/
function _isRacine( $id_document )
{
if ($id_document) {
$requete = "select pd_pere from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows() >0) {
if ($ligne->pd_pere == null){
return true ;
}
}
}
return false ;
} // end of member function _isRacine
 
/**
* Renvoie le chemin d'un fichier ou d'un répertoire. Contrairement à la classe
* mère, cette méthode renvoie une URL projet et non pas un fichier.
*
* @return string
* @access public
*/
function getChemin($prefixe = '')
{
$chemin_repertoire_entre_racine_et_fichier = '';
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
// l arborescence des repertoires
 
$tableau_navigation = $this->getPath($this->_id) ;
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
for ($i = 0; $i < count ($tableau_navigation); $i++) {
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
}
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
}
 
 
/**
* Renvoie pour le repertoire ou le fichier courant, les identifiants et les noms de tous les
* répertoires père jusqu'à la racine. 0 => ['id'], ['nom'] 1 => [id'], ['nom'] etc.
* En commençant par la racine et en descendant. Pour la racine id vaut "" et nom
* vaut "".
*
* @param int id_repertoire L'identifiant d'un répertoire.
* @return Array
* @access public
*/
 
function getCheminIdRepertoire( $id_doc, &$objetDB )
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($id_doc) ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0) {
if ($ligne->pd_pere == 0) {
return array ($ligne->pd_id);
}
array_push ($chemin_rep_id_nom, $ligne->pd_id) ;
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
}
return ($chemin_rep_id_nom);
}
 
function getPath( $id_doc)
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($id_doc) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
 
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
 
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0 && $ligne->pd_pere != 0 && $ligne->pd_pere != $ligne->pd_id) {
 
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
 
// Récursion sur le répertoires ou fichiers fils
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
}
 
return $chemin_rep_id_nom;
}
 
/**
* Calcule le chemin vers le fichier ou le répertoire uploadé
* renvoie un chaine de la forme dir1/dir2/fichier.ext
* En prenant comme racine le répertoire du projet, exclu.
* @return string Le chemin
*/
 
function calculeCheminUploaded ($radical) {
 
if (isset($_FILES['fichier']['name'])) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
}
 
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$doc_pere = new document ($this->_id_pere, $GLOBALS['projet_db']);
return $doc_pere->getChemin();
$tableau_navigation = $this->getPath($this->_id_pere) ;
 
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
} else {
// Si l'on est à la racine du projet, le chemin vide
return $radical ;
}
return $chemin ;
}
 
/**
* Enregistre une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur, $chemin) {
 
// On teste si on a affaire à un répertoire ou un fichier
if (isset ($_FILES['fichier']['name'])) {
// On tente de déterminer le type du fichier à partir de son nom dans $valeur['$fichier']
$tableau_nom = explode (".", $_FILES['fichier']['name']) ;
 
// On prend le dernier élément du tableau, si c'est un tableau
if (is_array($tableau_nom)) {
$extension = array_pop($tableau_nom) ;
$type = type_fichier_mime::factory($extension) ;
$id_extension = $type->getIdType() ;
} else {
$id_extension = 12 ;
}
$pd_lien = $chemin ;
} else { // Le cas ou on a affaire à un répertoire
$id_extension = 0 ;
// Le nom du répertoire est son identifiant avec un slash à la fin
$pd_lien = $chemin."/" ;
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $GLOBALS['projet_db']) ;
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$pd_lien .= $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
}
//$pd_lien .= SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
$pd_lien = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
}
$id = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id') ;
 
$requete = "insert into projet_documents set pd_id=".$id ;
$requete .= ", pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW(),".
"pd_ce_projet=\"".$this->_id_projet."\", pd_ce_utilisateur=\"".$this->_id_proprietaire."\"".
", pd_pere=\"$this->_id_pere\", pd_ce_type=\"$id_extension\", pd_lien=\"$pd_lien\"" ;
 
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
return $pd_lien;
}
 
function genereNouveauNom ($radical, $ancien_nom, $id) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $ancien_nom) ;
$nouveau_nom = $radical."_".$id.".".$extension ;
return $nouveau_nom;
}
 
/**
* Met à jour une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function majSQL ($valeur) {
$requete = "update projet_documents set pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW()".
" where pd_id=".$GLOBALS['projet_db']->escapeSimple($this->_id);
 
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return ;
}
 
/** Supprime les donnéexs du document dans la table projet_documents
*
*
* @return true en cas de succès
*/
 
function suppressionSQL () {
$requete = 'delete from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($this->_id) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if ($GLOBALS['projet_db']->affectedRows()) return true ;
return false ;
}
 
/**
* Déplace un document au sein d'un même projet
*
* @param int repertoire_destination L'identifiant du répertoire destination.
* @return bool
* @access public
*/
function deplace( $repertoire_destination, $repertoire_projet )
{
 
// On récupère les informations du répertoire cible
if ($repertoire_destination != 0) {
$repertoire_cible = new document ($repertoire_destination, $GLOBALS['projet_db']) ;
$chemin_rep_cible = $repertoire_cible->getChemin();
} else {
// Si le repertoire destination est la racine cad id =0
// on cree un document qui aura pour chemin le repertoire du projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
$chemin_rep_cible = $projet->getNomRepertoire().'/';
}
 
$nom_fichier = $this->_pd_lien ;
$requete = 'update projet_documents set pd_pere='.$GLOBALS['projet_db']->escapeSimple($repertoire_destination).' where pd_id='.$GLOBALS['projet_db']->escapeSimple($this->_id) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
return false ;
}
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier) ;
 
} // end of member function deplace
 
 
/**
* Pour modifier l'identifiant du projet auquel appartient un document.
*
* @param int id_projet L'identifiant du projet.
* @return void
* @access public
*/
function setIdProjet( $id_projet )
{
$this->_id_projet = $id_projet ;
} // end of member function setIdProjet
 
/**
* Permet de modifier l'identifiant du propietaire d'un projet.
*
* @param int id_proprietaire L'identifiant du proprietaire d'un document.
* @return void
* @access public
*/
function setIdProprietaire( $id_proprietaire )
{
$this->_id_proprietaire = $id_proprietaire ;
} // end of member function setIdProprietaire
 
/**
* Permet de modifier l'identifiant du répertoire d'un document.
*
* @param int id_repertoire L'identifiant du repertoire d'un document.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_pere = $id_repertoire;
} // end of member function setIdRepertoire
 
/**
* initAttributes sets all document attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_visibilite = "public";
}
 
/**
* Renvoie les derniers documents de l'ensemble des projets.
*
* @param int nombre Le nombre de document à renvoyer
* @return Array
* @static
* @access public
*/
function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
{
// on recherche les documents, hors repertoire
$requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
if ($id_projet != '') $requete .= ' and pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_projet).' ';
if (!$visible) $requete .= ' and pd_visibilite="public" ';
$requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_document = array() ;
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
} // end of member function getDocumentsRecents
 
/**
* Renvoie les documents du projet passe en parametre sous forme d arbre d objet document
*
* @param int l identifiant du projet
* @return Array
* @static
* @access public
*/
function getArbreDocument($id_projet, $objetDB = '') {
$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_projet);
$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
 
return $resultat;
}
/**
* Renvoie la taille du document formatee avec une unite adapte
*
* @return string La taille formate
* @access public
*/
function getTailleFormatee($precision = 1) {
$taille = $this->getTaille();
if ($taille > 1000000) {
$diviseur = 1000000;
$unite = 'Mo';
} else {
$diviseur = 1000 ;
$unite = 'Ko';
}
return round ($taille / $diviseur, $precision).'&nbsp;'.$unite;
}
 
/**
* Renvoie une liste de document, enfant du document courant
* qui doit etre un repertoire bien sur
*
* @return mixed un tableau de document
* @access public
*/
function getDocumentsEnfant() {
 
}
 
} // end of document
 
 
?>
/trunk/classes/AJAX_arbreDocuments.class.php
1,353 → 1,353
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: AJAX_arbreDocuments.class.php,v 1.1 2007/04/19 09:20:26 alexandre_tb Exp $
/**
* Application projet
*
* La classe AJAX_arbreDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
// Appel de la bibliotheque dojo
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
 
/**
* class HTML_listeDocuments
*
*/
class AJAX_arbreDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront passées en paramètre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du répertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des répertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function AJAX_arbreDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
//HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
} // end of member function HTML_listeDocuments
 
function AJAX_construitListe($id_projet, $droits, $mode = '', $objetDB = '') {
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
// Le noeud racine
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">
<div dojoType="TreeNode" title="Racine" widgetId="eisleyRoot" objectId="root" isFolder="true"></div>';
 
 
 
return $res ;
}
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
$this->AJAX_arbreDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels à afficher dans l'entête.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array tableau_label Un tableau à deux dimensions avec les labels à afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '')
{
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
 
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Première condition : est-ce que le fichier a pour père le répertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un répertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getChemin()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$lien = $tableau_document[$i]->getChemin() ;
}
// pour éviter des effets de bords, on enlève id_repertoire de l'url
// dans le cas d'un répertoire, pour les fichiers on le laisse pour
// qu'après une opération, on reste dans le répertoire où a eu lieu l'opération
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insère le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
// Pour la taille on divise par 1000 et on écrit Ko
$taille = round($tableau_document[$i]->getTaille() / 1000).'&nbsp;Ko' ;
// Récupération de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau à donner en paramètre à HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme clé. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
} // end of member function setAction
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcones
 
/**
* Surcharge de l'opération de la classe mère. Ajoute la navigation dans les
* répertoires.
*
* @return string
* @access public
*/
function toHTML( )
{
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i+=2) {
$chemin_navig .= "&gt;&nbsp;" ;
$nom = $this->_chemin_navigation[$i+1] ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des répertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la légende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
} // end of member function affLegende
 
 
/**
* Renvoie le chemin HTML, depuis le répertoire courant jusqu'à la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
} // end of member function _getCheminHTML
 
 
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est à dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
if (!$document->isRepertoire()) $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: AJAX_arbreDocuments.class.php,v 1.2 2007-10-10 13:52:52 alexandre_tb Exp $
/**
* Application projet
*
* La classe AJAX_arbreDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
// Appel de la bibliotheque dojo
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
 
/**
* class HTML_listeDocuments
*
*/
class AJAX_arbreDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront passées en paramètre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du répertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des répertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function AJAX_arbreDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
//HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
} // end of member function HTML_listeDocuments
 
function AJAX_construitListe($id_projet, $droits, $mode = '', $objetDB = '') {
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
// Le noeud racine
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">
<div dojoType="TreeNode" title="Racine" widgetId="eisleyRoot" objectId="root" isFolder="true"></div>';
 
 
 
return $res ;
}
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
$this->AJAX_arbreDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels à afficher dans l'entête.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array tableau_label Un tableau à deux dimensions avec les labels à afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '')
{
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
 
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Première condition : est-ce que le fichier a pour père le répertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un répertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getChemin()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$lien = $tableau_document[$i]->getChemin() ;
}
// pour éviter des effets de bords, on enlève id_repertoire de l'url
// dans le cas d'un répertoire, pour les fichiers on le laisse pour
// qu'après une opération, on reste dans le répertoire où a eu lieu l'opération
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insère le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
// Pour la taille on divise par 1000 et on écrit Ko
$taille = round($tableau_document[$i]->getTaille() / 1000).'&nbsp;Ko' ;
// Récupération de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau à donner en paramètre à HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme clé. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
} // end of member function setAction
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcones
 
/**
* Surcharge de l'opération de la classe mère. Ajoute la navigation dans les
* répertoires.
*
* @return string
* @access public
*/
function toHTML( )
{
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i+=2) {
$chemin_navig .= "&gt;&nbsp;" ;
$nom = $this->_chemin_navigation[$i+1] ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des répertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la légende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
} // end of member function affLegende
 
 
/**
* Renvoie le chemin HTML, depuis le répertoire courant jusqu'à la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
} // end of member function _getCheminHTML
 
 
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est à dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
if (!$document->isRepertoire()) $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>
/trunk/classes/HTML_listeParticipants.class.php
1,216 → 1,216
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeParticipants.class.php,v 1.4 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeParticipants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
 
 
/**
* class HTML_listeParticipants
*
*/
class HTML_listeParticipants extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Le mode, par défaut 0 => normal 1 => modification En mode modification, une
* colonne de plus pour désinscrire un utilisateur
* @access private
*/
var $_mode;
/**
* L'url vers la page affichant la liste
* @access private
*/
var $_url;
 
/**
*
*
* @return void
* @access public
*/
function HTML_listeParticipants( $utilise_pager)
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
} // end of member function HTML_listeParticipants
 
/**
*
*
* @param Array elements Tableau des éléments de l'entête. Des labels.
* @return void
* @access public
*/
function construitEntete( $elements )
{
if ($this->_mode == 1) {
array_push ($elements, PROJET_SUPPRIMER) ;
}
$this->addRow ($elements, '', 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array elements Tableau à deux dimension contenant les éléments à afficher.
* @return void
* @access public
*/
function construitListe( $elements, $tableau_statut = '', &$projet )
{
for ($i = 0; $i < count ($elements) ; $i++) {
// L'identifiant de l'utilisateur est le premier élément du tableau
$id_utilisateur = array_shift ($elements[$i]) ;
// L'identifiant du statut est le dernier
if (count ($elements)>5) $inscrit_liste = (int) array_pop ($elements[$i]);
$id_statut = (int) array_pop ($elements[$i]) ;
// En mode modif on ajoute la colonne supprimer
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$this->_url->addQueryString('statut', 4) ;
$supprimer = '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'.PROJET_SUPPRIMER.'</a>';
if (count ($elements) > 5) array_push ($elements[$i], '');
array_push ($elements[$i], '', $supprimer);
$this->_url->removeQueryString('statut') ;
}
// La colonne avec l inscription a la liste de discussion
$this->addRow ($elements[$i]) ;
// mise à jour du champs mail en l'entourant par la balise mailto
/// $i+1 pour sauter la ligne de titre,
if (strlen ($elements[$i][2]) > 10) {
$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;
}
$this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
// Mise à jour de la cellule contenant le statut
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
foreach ($tableau_statut as $cle =>$element_statut) {
$select .= '<option value="'.$cle.'"' ;
if ($cle == $id_statut) {
$select .= ' selected="selected"' ;
}
$select .= '>'.$element_statut.'</option>'."\n" ;
}
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 4, $select) ;
// Colonne avec l inscription a la liste de discussion
if (count ($elements)>5) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="inscription_liste" onchange="javascript:this.form.submit();">' ;
$select .= '<option value="0">Non inscrit</option>';
$select .= '<option value="1"'.($inscrit_liste ? ' selected="selected"': '').'>Inscrit</option>';
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 5, $select) ;
}
}
if ($id_statut == 1 && $this->_mode != 1) {
$this->setCellContents($i + 1, 4, PROJET_CHEF) ;
$this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
}
if ($this->_mode != 1 && $id_statut != 1) {
$this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
}
$this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
$this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
}
} // end of member function construitListe
 
/**
*
*
* @return void
* @access public
*/
function setModeModification( )
{
$this->_mode = 1 ;
} // end of member function setModeModification
 
/**
* Renvoie le code HTML de la table.
*
* @return string
* @access public
*/
function toHTML( )
{
// Application de style
$this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
// s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
if ($this->getRowCount() == 1) {
return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
}
$res = HTML_Table::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Fixe la valeur de l'URL
*
* @param Net_URL url Un pointeur vers un objet Net_URL
* @return void
* @access public
*/
function setURL( &$url )
{
$this->_url = $url ;
} // end of member function setURL
 
} // end of HTML_listeParticipants
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeParticipants.class.php,v 1.5 2008-08-25 15:13:17 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeParticipants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
 
 
/**
* class HTML_listeParticipants
*
*/
class HTML_listeParticipants extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Le mode, par défaut 0 => normal 1 => modification En mode modification, une
* colonne de plus pour désinscrire un utilisateur
* @access private
*/
var $_mode;
/**
* L'url vers la page affichant la liste
* @access private
*/
var $_url;
 
/**
*
*
* @return void
* @access public
*/
function HTML_listeParticipants( $utilise_pager)
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
} // end of member function HTML_listeParticipants
 
/**
*
*
* @param Array elements Tableau des éléments de l'entête. Des labels.
* @return void
* @access public
*/
function construitEntete( $elements )
{
if ($this->_mode == 1) {
array_push ($elements, PROJET_SUPPRIMER) ;
}
$this->addRow ($elements, '', 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array elements Tableau à deux dimension contenant les éléments à afficher.
* @return void
* @access public
*/
function construitListe( $elements, $tableau_statut = '', &$projet )
{
for ($i = 0; $i < count ($elements) ; $i++) {
// L'identifiant de l'utilisateur est le premier élément du tableau
$id_utilisateur = array_shift ($elements[$i]) ;
// L'identifiant du statut est le dernier
if (count ($elements)>5) $inscrit_liste = (int) array_pop ($elements[$i]);
$id_statut = (int) array_pop ($elements[$i]) ;
// En mode modif on ajoute la colonne supprimer
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$this->_url->addQueryString('statut', 4) ;
$supprimer = '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'.PROJET_SUPPRIMER.'</a>';
if (count ($elements) > 5) array_push ($elements[$i], '');
array_push ($elements[$i], '', $supprimer);
$this->_url->removeQueryString('statut') ;
}
// La colonne avec l inscription a la liste de discussion
$this->addRow ($elements[$i]) ;
// mise à jour du champs mail en l'entourant par la balise mailto
/// $i+1 pour sauter la ligne de titre,
if (strlen ($elements[$i][2]) > 10) {
$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;
}
$this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
// Mise à jour de la cellule contenant le statut
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
foreach ($tableau_statut as $cle =>$element_statut) {
$select .= '<option value="'.$cle.'"' ;
if ($cle == $id_statut) {
$select .= ' selected="selected"' ;
}
$select .= '>'.$element_statut.'</option>'."\n" ;
}
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 4, $select) ;
// Colonne avec l inscription a la liste de discussion
if (count ($elements)>5) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="inscription_liste" onchange="javascript:this.form.submit();">' ;
$select .= '<option value="0">Non inscrit</option>';
$select .= '<option value="1"'.($inscrit_liste ? ' selected="selected"': '').'>Inscrit</option>';
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 5, $select) ;
}
}
if ($id_statut == 1 && $this->_mode != 1) {
$this->setCellContents($i + 1, 4, PROJET_CHEF) ;
$this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
}
if ($this->_mode != 1 && $id_statut != 1) {
$this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
}
$this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
$this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
}
} // end of member function construitListe
 
/**
*
*
* @return void
* @access public
*/
function setModeModification( )
{
$this->_mode = 1 ;
} // end of member function setModeModification
 
/**
* Renvoie le code HTML de la table.
*
* @return string
* @access public
*/
function toHTML( )
{
// Application de style
$this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
// s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
if ($this->getRowCount() == 1) {
return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
}
$res = HTML_Table::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Fixe la valeur de l'URL
*
* @param Net_URL url Un pointeur vers un objet Net_URL
* @return void
* @access public
*/
function setURL( &$url )
{
$this->_url = $url ;
} // end of member function setURL
 
} // end of HTML_listeParticipants
?>
/trunk/classes/HTML_formulaireListe.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireListe.class.php,v 1.2 2005/09/27 16:40:39 alexandre_tb Exp $
// CVS : $Id: HTML_formulaireListe.class.php,v 1.2 2005-09-27 16:40:39 alexandre_tb Exp $
/**
* Application projet
*
/trunk/langues/pro_langue_fr.local.php
File deleted
/trunk/langues/pro_langue_en.inc.php
4,8 → 4,8
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2003 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la cr�ation de projet, avec une gestion de la |
* | propri�t�s des documents... |
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
99,7 → 99,7
define ('PROJET_DESCRIPTION', 'Description') ;
define ('PROJET_WIKINI', 'Wikini') ;
 
// ========== Synth�se ===============================
// ========== Synthèse ===============================
define ('PROJET_RESUME', 'Summary') ;
define ('PROJET_WIKI_ASSOCIE', 'Linked wiki') ;
define ('PROJET_ALLER_SUR_WIKINI', 'Go to wiki') ;
235,9 → 235,9
define ("BAZ_ANNULER", "Cancel") ;
define ("BAZ_RETOUR_LISTE", "Back to project list") ;
 
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire � un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire à un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_1", "La personne avec le mail suivant :\n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_2", "\nsouhaite s'inscrire au projet : \n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez mod�rer cette inscription.") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez modérer cette inscription.") ;
define ("BAZ_DEMANDE_INSCRIPTION_PRISE_EN_COMPTE", "Votre demande d'inscription a &eacute;t;&eacute; transmise aux coordinateurs du projet") ;
?>
/trunk/langues/pro_langue_pt.inc.php
10,7 → 10,7
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_pt.inc.php,v 1.3 2005/09/28 16:29:39 ddelon Exp $
* $Id: pro_langue_pt.inc.php,v 1.3 2005-09-28 16:29:39 ddelon Exp $
*/
 
 
/trunk/langues/pro_langue_es.inc.php
4,8 → 4,8
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2003 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la cr�ation de projet, avec une gestion de la |
* | propri�t�s des documents... |
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
51,7 → 51,7
define ("PROJET_FICHIERS_NOM", "Nombre") ;
define ("PROJET_FICHIERS_CREE_LE", "Creado el") ;
define ("PROJET_FICHIERS_PAR", "Por") ;
define ("PROJET_FICHIERS_TAILLE", "Tama�o") ;
define ("PROJET_FICHIERS_TAILLE", "Tamaño") ;
define ("PROJET_RACINE", "Raiz") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibilidad") ;
define ("PROJET_METTRE_FICHIER", "Hacer un nuevo fichero") ;
62,8 → 62,8
define ("PROJET_LEGENDE_MODIFIE", "Modificar las informaciones de un documento") ;
define ("PROJET_LEGENDE_SUPPR", "Cancelar un fichero") ;
define ("PROJET_EMAIL", "Correo electronico") ;
define ("PROJET_MOT_DE_PASSE", "Contrase�a") ;
define ("PROJET_TEXTE_PERDU", "Si ha perdido su contrase�a, indique su correo electronico en el espaciologin y haga clic en Ingresar") ;
define ("PROJET_MOT_DE_PASSE", "Contraseña") ;
define ("PROJET_TEXTE_PERDU", "Si ha perdido su contraseña, indique su correo electronico en el espaciologin y haga clic en Ingresar") ;
 
//================ Partie concernant l'upload de fichier=======================================
define ("PROJET_DOCUMENT_DU_PROJET", "Documento del proyecto") ;
102,7 → 102,7
 
//==================== labels pour projet_liste=======================================================
define ("PROJET_LISTE", "Lista de Proyectos") ;
define ("PROJET_NOMBRE_EN_COURS", "Num�ro de proyectos en curso.") ;
define ("PROJET_NOMBRE_EN_COURS", "Numéro de proyectos en curso.") ;
 
// ========== Labels pour projet_inscription ===========================================
define ("PROJET_PROJET", "Proyecto") ;
120,9 → 120,9
define ("BAZ_ANNULER", "Annuler") ;
define ("BAZ_RETOUR_LISTE", "Retourner &agrave; la liste des projets") ;
 
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire � un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire à un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_1", "La personne avec le mail suivant :\n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_2", "\nsouhaite s'inscrire au projet : \n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez mod�rer cette inscription.") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez modérer cette inscription.") ;
define ("BAZ_DEMANDE_INSCRIPTION_PRISE_EN_COMPTE", "Votre demande d'inscription a &eacute;t;&eacute; transmise aux coordinateurs du projet") ;
?>
/trunk/langues/pro_langue_fr.inc.php
1,281 → 1,281
<?php
/* +-----------------------------------------------------------------------+
* |pro_langue_fr.inc.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2003 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_fr.inc.php,v 1.16.2.3 2008-04-16 12:42:11 alexandre_tb Exp $
*/
 
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.local.php')) {
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.local.php' ;
}
 
// LA liste des projet
 
define ('PROJET_TEXTE_NON_IDENTIFIE', 'Vous n\'êtes pas identifié. Identifiez-vous pour accéder à vos projets ou pour vous inscrire aux projets') ;
define ('PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE', 'Vous n\'êtes pas identifié. Identifiez-vous pour accéder à la liste des participants') ;
 
// ========== Partie concernant la description su projet =================================
 
define ('PROJET_PROJET', 'Projet') ;
define ('PROJET_PAS_DE_PROJET', 'Il n\'y a aucun projet pour le moment.');
define ("PROJET_ALERTE_TITRE", "Le champs titre ne doit pas &ecirc;tre vide") ;
define ("PROJET_TITRE", "Titre") ;
if (!defined ('PROJET_RESUME')) {
define ('PROJET_RESUME', 'Résumé') ;
}
define ('PROJET_SYNTHESE', 'Synthèse') ;
define ("PROJET_DECONNEXION", "D&eacute;connexion") ;
define ("PROJET_ADMINISTRATION", "Administration") ;
define ("PROJET_ADMINISTRATEUR", 'administrateur') ;
define ("PROJET_NOUVEAU_PROJET", "Nouveau projet") ;
define ('PROJET_ACCUEIL', 'Description du projet') ;
define ('PROJET_PERE', 'Projet père') ;
define ('PROJET_MODIFIER_PROPRIETES', 'Modifier le projet') ;
define ("PROJET_DESTRUCTION_PROJET", "Destruction d'un projet") ;
define ("PROJET_GESTION_UTILISATEUR", "Gérer les participants") ;
define ("PROJET_NOUVEAU_UTILISATEUR", "Nouveau participant") ;
define ('PROJET_NOUVEAU_UTILISATEUR_LAIUS', 'Pour ajouter un participant, inscrivez son adresse mail ci-contre et cliquer sur '.PROJET_NOUVEAU_UTILISATEUR) ;
define ("PROJET_MOD_UTILISATEUR", "Modification d'un utilisateur") ;
define ("PROJET_DESTRUCTION_UTILISATEUR", "Suppression d'un utilisateur") ;
define ("PROJET_VOIR_PROJET", "Voir le projet") ;
define ('PROJET_S_INSCRIRE', 'S\'inscrire') ;
define ('PROJET_SE_DESINSCRIRE_LISTE', 'Se désinscrire') ;
define ('PROJET_SE_DESINSCRIRE_CONFIRMATION', 'Etes vous sûr de vouloir vous désinscrire ?') ;
define ("PROJET_GERER", "G&eacute;rer") ;
define ("PROJET_GERER_FICHIER", "G&eacute;rer fichiers") ;
define ("PROJET_VOIR_FICHIER", "Voir fichiers") ;
define ('PROJET_NOM', 'Nom') ;
define ("PROJET_PRENOM", "Pr&eacute;nom") ;
define ("PROJET_MAIL", "E mail") ;
define ('PROJET_DETAIL_PROJET', 'Détail du projet') ;
define ("PROJET_LABEL_PAYS", "Pays") ;
define ("PROJET_DATE_INSCRIPTION", "Date d'inscription") ;
define ("PROJET_STATUT", "Statut") ;
define ('PROJET_VOUS_ETES', 'Vous êtes ') ;
define ("PROJET_CHEF" ,"Coordonnateur") ;
define ('PROJET_CONTRIBUTEUR', 'Participants') ;
define ('PROJET_NON_INSCRIT', 'non inscrit') ;
define ("PROJET_PAS_D_INSCRIT", "Il n' y a pas d'inscrit à ce projet") ;
define ("PROJET_PARTICIPER", "Les projets auxquels vous participez") ;
define ("PROJET_VOUS_PARTICIPEZ", "Vous participez &agrave; ce projet") ;
define ("PROJET_TOUS", "tous les projets.") ;
define ("PROJET_PROJETS", "projets") ;
define ('PROJET_TYPE', 'Type du projet') ;
define ("PROJET_VOTRE_STATUT", "Votre statut") ;
define ("PROJET_ACTION", "Action") ;
define ('PROJET_SUPPRIMER', 'supprimer') ;
define ('PROJET_SUPPRIMER_LE_PROJET', 'Supprimer le projet') ;
define ('PROJET_SUPPRIMER_PROJET_CONFIRMATION', 'Supprimer le projet ?') ;
define ("PROJET_DESTRUCTION_LAIUS", "La destruction d'un projet implique la suppression de tous les droits ".
"de tous les utilisateurs de ce projet, ainsi que les liens que les autres projets ont ".
"avec lui.") ;
define ("PROJET_DESTRUCTION_EFFECTUEE", "Destruction effectu&eacute;e") ;
define ("PROJET_GESTION_PROJET", "Gestion du projet") ;
define ("PROJET_EN_TANT_QUE", "En tant que") ;
define ("PROJET_INTERVENIR", "vous pouvez intervenir sur les items suivants") ;
define ("PROJET_PROPRIETES", "Propri&eacute;t&eacute;s du projet") ;
define ("PROJET_SELECTIONNER", "S&eacute;lectionner un r&eacute;pertoire cible pour") ;
define ("PROJET_PB_COPIE", "Probl&eagrave;me lors de la copie") ;
define ("PROJET_RETABLISSEMENT", "R&eacute;tablissement de la base de donnée...") ;
define ("PROJET_RETBLISSEMENT_EFFECTUE", "R&eacute;tablissement effectu&eacute;. Vous pouvez r&eacute;essayer.") ;
define ("PROJET_METTRE_FICHIER", "Mettre un fichier en ligne") ;
define ("PROJET_CREER_REP", "Cr&eacute;er un r&eacute;pertoire") ;
define ("PROJET_FICHIERS_ASSOCIES", "Les fichiers associ&eacute;s au projet") ;
define ('PROJET_PAS_DE_DOCUMENTS', 'Pas de documents associés à ce projet') ;
define ("PROJET_FICHIERS_NOM", "Nom") ;
define ("PROJET_FICHIERS_CREE_LE", "Cr&eacute;&eacute; le") ;
define ("PROJET_FICHIERS_PAR", "Par") ;
define ("PROJET_FICHIERS_TAILLE", "Taille") ;
define ("PROJET_RACINE", "Racine") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibilit&eacute;");
define ("PROJET_FICHIERS_ACTION", "Action") ;
define ("PROJET_LEGENDE", "L&eacute;gende") ;
define ("PROJET_LEGENDE_DEPLACE", "D&eacute;place un fichier");
define ("PROJET_LEGENDE_MODIFIE", "Modifie les informations d'un document") ;
define ("PROJET_LEGENDE_SUPPR", "Supprime un fichier");
define ("PROJET_CHAMPS_REQUIS", "D&eacute;signe les champs obligatoires") ;
define ("PROJET_EMAIL", "e-mail") ;
define ("PROJET_MOT_DE_PASSE", "Mot de passe") ;
define ("PROJET_TEXTE_PERDU", "Si vous avez perdu votre mot de passe, indiquer ".
"votre adresse email dans le champs login ci-dessus et cliquez sur \"Valider\"") ;
define ("PROJET_DESCRIPTION", "Description") ;
define ("PROJET_ESPACE_INTERNET", "Espace internet") ;
define ('PROJET_PAS_DE_SITE', 'Pas d\'espace internet externe') ;
define ("PROJET_DESTRUCTION_ALERTE", "Etes-vous sûr de vouloir supprimer ce projet ?") ;
define ("PROJET_MENU_GENERAL", "Menu G&eacute;n&eacute;ral") ;
define ('PROJET_MENU_COORD', 'Menu du coordinateur') ;
define ('PROJET_MENU_CONTRI', 'Menu du Contributeur') ;
define ('PROJET_MENU_OBS', 'Menu de l\'observateur') ;
 
define ('PROJET_CREER_LISTE', 'Créer un forum de discussion') ;
define ('PROJET_LISTE_DE_DISCUSSION', 'Forum de discussion') ;
define ('PROJET_SUPPRIMER_LISTE', 'Supprimer le forum de discussion') ;
define ('PROJET_SUPPRIMER_LISTE_CONFIRMATION', 'Supprimer le forum ?') ;
define ('PROJET_NOM_DE_LA_LISTE', 'Nom du forum') ;
define ('PROJET_NOM_DE_LA_LISTE_REQUIRED', 'Le nom du forum est requis') ;
define ('PROJET_DOMAINE_DE_LA_LISTE', 'Domaine du forum') ;
define ('PROJET_DOMAINE_LISTE_REQUIRED', 'Le domaine est requis') ;
define ('PROJET_MESSAGE_LISTE_DOUBLE', 'Un forum de ce nom la existe déjà') ;
define ('PROJET_PAS_DE_LISTE', 'Pas de forum') ;
define ('PROJET_FORUM', 'Forum') ;
if (!defined ('PROJET_PROPOSER_PROJET')) {
define ('PROJET_PROPOSER_PROJET', '<h1>Proposer un projet</h1><p>');
}
define ('PROJET_RETOUR_RESUME', 'Retour au résumé');
 
define ('PROJET_VOIR_PROFIL', 'Voir le profil de ce participant');
 
define ('PROJET_MODERE', 'Inscription modérée');
define ('PROJET_NON_MODERE', 'Inscription non modérée');
define ('PROJET_INSCRIPTION', 'Inscription') ;
define ('PROJET_DEMANDE_INSCRIPTION', 'Demande d\'inscription au projet');
define ('PROJET_EN_ATTENTE', 'en attente de validation');
 
define ('PROJET_LAIUS_INSCRIPTION_MODERE', 'Votre demande d\'inscription au projet "nom_du_projet" a &eacute;t&eacute; enregistr&eacute;e et
est propos&eacute;e pour acceptation au coordonnateur du projet"<br /><br />
Un accus&eacute; r&eacute;ception vous sera envoy&eacute; à votre courriel d\'inscription
confirmant l\'acception de votre inscription.<br /><br />
Vous pourrez alors acc&eacute;der à toutes les fonctions du projet "nom_du_projet"');
 
// ========== Partie concernant l'upload de fichier =================================
 
define ("PROJET_DOCUMENT_DU_PROJET", "Documents du projet") ;
define ('PROJET_FICHIERS_RECENTS', 'Les derniers documents du projet') ;
define ("PROJET_FICHIER_MISE_EN_LIGNE", "Mise en ligne d'un fichier") ;
define ("PROJET_FICHIER_NOM_DOCUMENT", "Nom du document") ;
define ("PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION", "Saisissez un nom explicite, il correspond ".
"au texte sur lequel il faudra cliquer pour acc&eacute;der au fichier.") ;
define ("PROJET_FICHIER_ALERTE", "Vous devez saisir un nom pour le document") ;
define ("PROJET_FICHIER_DESCRIPTION", "Description") ;
define ("PROJET_FICHIER_PUBLIC", "Tout public") ;
define ("PROJET_FICHIER_PRIVEE", "Projet seulement") ;
define ("PROJET_FICHIER_LE_FICHIER", "Le fichier") ;
define ("PROJET_FICHIER_ALERTE_PAS_DE_FICHIER", "Vous devez sélectionner un fichier") ;
define ("PROJET_FICHIER_CONTINUER", "Continuer") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE_2", "Mise en ligne d'un fichier &eacute;tape 2") ;
define ("PROJET_FICHIER_LABEL", "Label") ;
define ("PROJET_FICHIER_TYPE", "Type") ;
define ("PROJET_FICHIER_TRANSFERT_T", "Transfert termin&eacute;...");
define ("PROJET_FICHIER_VALIDER", "Valider") ;
define ("PROJET_FICHIER_MODIFIER", "Modifier") ;
define ("PROJET_FICHIER_COLLER", "COLLER") ;
define ("PROJET_FICHIER_COUPER", "Déplacer") ;
define ("PROJET_FICHIER_ANNULER", "Annuler") ;
define ("PROJET_FICHIER_SUPPRIMER", "Supprimer") ;
define ('PROJET_CHOISISSEZ_REPERTOIRE', 'Choisissez un répertoire pour ce fichier') ;
define ('PROJET_CHANGER_REPERTOIRE', 'CHANGER UN FICHIER DE REPERTOIRE') ;
define ('PROJET_FICHIER_A_DEPLACER', 'Fichier à déplacer : ') ;
define ('PROJET_DOCUMENT', 'Documents') ;
define ('PROJET_AFFICHAGE_ARBORESCENT', 'Affichage arborescent');
define ('PROJET_AFFICHAGE_CLASSIQUE', 'Affichage classique');
// Création de répertoire
define ("PROJET_REP", "R&eacute;pertoire du projet") ;
define ("PROJET_REP_CREER", "Cr&eacute;ation d'un nouveau r&eacute;pertoire") ;
define ("PROJET_REP_MODIFIER", "Modification d'un r&eacute;pertoire") ;
define ("PROJET_REP_SUPPRIMER", "&ecirc;tes-vous s&ucirc;r de vouloir supprimer le r&eacute;pertoire") ;
 
// ========== Partie concernant les wikini ===========================================
 
define ('PROJET_CREER_WIKI', 'Gestion Wikinis') ;
define ('PROJET_ASSOCIER_WIKI', 'Associer un Wikini');
if (!defined ('PROJET_WIKI_ASSOCIE')) {
define ('PROJET_WIKI_ASSOCIE', 'Espace de rédaction collaborative') ;
}
define ("PROJET_WIKINI_POSSEDE", "Ce projet poss&egrave;de un espace wikini") ;
define ("PROJET_WIKINI_ALLER", "") ;
define ("PROJET_WIKINI_SUPPRIMER", "Supprimer le wikini") ;
define ("PROJET_WIKINI_CHOISIR_NOM", "Choisissez un nom pour le wikini") ;
define ("PROJET_WIKINI_NOM_EXPLICATION", "Le nom doit &ecirc;tre au format wikini, c'est &agrave; dire sans accents, sans espaces et avec au moins deux majuscule. ex MonProjet") ;
define ("PROJET_WIKINI_NOM_INVALIDE", "Ce n'est pas un nom wiki valide") ;
define ("PROJET_WIKINI_NOM_EXISTE", "Il existe d&eacute;j&agrave; un wikini de ce nom la !!") ;
define ("PROJET_WIKINI_PAS", "Pas de Wikini pour ce projet.") ;
define ("PROJET_WIKINI_PAS_REDIR", 'Pour consulter et/ou participer à la rédaction collaborative de ce projet,<br />vous pouvez vous rendre dans le <a class="acceder-outil" href="%s">wikini mis à votre disposition</a>') ;
define ('PROJET_NOM_WIKINI_REQUIS', 'Le nom Wikini est requis') ;
define ('PROJET_PREFIXE_WIKINI', 'Préfixe wikini') ;
define ('PROJET_PREFIXE_WIKINI_REQUIS', 'Le préfixe est requis') ;
if (!defined('PROJET_WIKINI')) {
define ('PROJET_WIKINI', 'Wikini') ;
}
define ("PROJET_NOM_WIKINI", "Nom Wikini") ;
define ("PROJET_PAGE_WIKINI", "Page de démarrage") ;
define ("PROJET_CHOISIR_WIKINI", "Choisir") ;
define ("PROJET_SELECTIONNER_WIKINI", "Selection") ;
 
 
define ("PROJET_LISTE_PARTICIPANT", "Liste des participants") ;
define ("PROJET_LISTE_PARTICIPANT_LAIUS", "Vous &ecirc;tes chef du projet. Vous pouvez &agrave; ce titre, modifier le statut ".
"des participants ou les d&eacute;sinscrire en cas de probl&egrave;me.<br />".
"ttention aux cons&eacute;quences que cela peut avoir...<br />".
"En tant que chef de projet, vous ne pouvez pas modifier votre statut. Si vous souhaitez abandonner ".
"cette fonction, il faut en faire la demande &agrave; l'administrateur du syst&egrave;me&nbsp;&nbsp;") ;
define ("PROJET_DESINSCRIRE_SUR", "&ecirc;tes-vous s&ucirc;r de vouloir d&eacute;sinscrire") ;
define ('PROJET_MAIL_ABSENT', 'L\'email que vous avez saisi n\'est pas dans l\'annuaire') ;
define ('PROJET_ALLER_SUR_WIKINI', 'Entrer dans la page') ;
 
// ========== Labels pour projet_liste ===========================================
 
define ("PROJET_LISTE", "Liste des projets") ;
define ('PROJET_TOUS_LES_PROJETS', 'Les autres projets du réseau') ;
define ("PROJET_NOMBRE_EN_COURS" ,"Nombre de projets en cours") ;
if (!defined ('PROJET_INSCRIT_AUCUN_PROJET')) define ('PROJET_INSCRIT_AUCUN_PROJET', 'Vous n\'êtes inscrit à aucun projet<br />
- <a href="http://www.tela-botanica.org/page:aide_projet">Qu\'est-ce qu\'un projet ?</a><br />
Le réseau Tela Botanica est organisé autour de projets, discussions ou
échanges liés à  la botanique. Vous pouvez y participer en vous
inscrivant.') ;
define ('PROJET_CREATION_LISTE', 'Création d\'un forum de discussion') ;
define ('PROJET_LISTES_EXTERNES_ASSOCIEES', 'Forum associé du projet') ;
define ('PROJET_REFERENCER_LISTE', 'Référencer un forum externe') ;
 
// ========== Labels pour projet_inscription ===========================================
 
define ("PROJET_VOTRE_STATUT_AU_PROJET", "Votre statut par rapport au projet") ;
if (!defined ('PROJET_INSCRIPTION_LISTE_NORMAL')) define ('PROJET_INSCRIPTION_LISTE_NORMAL', 'Je reçois les messages du forum') ;
if (!defined ('PROJET_INSCRIPTION_LISTE_RESUME')) define ('PROJET_INSCRIPTION_LISTE_RESUME', 'Je m\'inscrit à la version résumé du forum') ;
if (!defined ('PROJET_INSCRIPTION_PAS_DE_MAIL')) define ('PROJET_INSCRIPTION_PAS_DE_MAIL', 'Je ne souhaite pas recevoir de messages de ce forum') ;
define ('PROJET_INSCRIPTION_PROJET', 'Inscription au projet') ;
define ('PROJET_S_INSCRIRE_AU_PROJET', 'S\'inscrire au projet') ;
define ('PROJET_MESSAGE_LISTE', 'Messages du forum') ;
define ('PROJET_ADRESSE_ECRIRE', 'Adresse pour écrire au forum') ;
define ('PROJET_TOUS_LES_MESSAGES', 'Tous les messages') ;
define ('PROJET_DERNIERS_MESSAGES', 'Derniers messages du forum du projet') ;
define ('PROJET_DERNIER_MESSAGE', 'Dernier message') ;
define ('PROJET_MESSAGE_DU_MOIS', 'Messages du mois ') ;
define ('PROJET_RECEVOIR_MESSAGES', 'Recevoir les messages') ;
define ('PROJET_NE_PAS_RECEVOIR_MESSAGES', 'Ne plus recevoir de messages') ;
define ('PROJET_MESSAGES_DE', 'Messages de ') ;
define ('PROJET_FILE_DE_DISCUSSION', 'fil de discussion') ;
define ('PROJET_VOUS_N_ETES_PAS_INSCRIT', 'Vous n\'êtes pas inscrit à ce projet') ;
define ('PROJET_VOUS_ETES_PARTICIPANT', 'Vous êtes participant à ce projet') ;
define ('PROJET_SE_DESINSCRIRE', 'Se désinscrire du projet') ;
 
 
// ======================= Labels pour l'envoie d'email ==================================
define ("PROJET_MAIL_TITRE", "Titre") ;
define ("PROJET_MAIL_TITRE_REQUIS", "Vous devez indiquer au moins un titre") ;
define ("PROJET_MAIL_CORPS", "Corps") ;
define ("PROJET_ECRIRE_LISTE", "Ecrire au forum") ;
define ('PROJET_LISTES_ASSOCIEES', 'Forum associé au projet') ;
 
define ('PROJET_RECEVOIR_LES_MESSAGES', 'Recevoir les messages') ;
define ('PROJET_NE_PAS_RECEVOIR', 'Pas de messages') ;
define ('PROJET_RECEVOIR_DES_RESUMES', 'Recevoir des résumés') ;
define ('PROJET_VOUS_ETES_INSCRIT', 'Vous êtes inscrit à ce forum.') ;
define ('PROJET_LISTE_PRIVE', 'Vous devez inscrit pour être');
// Label pour l'affichage des messages dans le forum
define ('PROJET_PRECEDENT', 'précédent') ;
define ('PROJET_SUIVANT', 'suivant') ;
define ('PROJET_REPONDRE', 'répondre') ;
define ('PROJET_REDIGER_REPONSE', 'Rédiger votre réponse') ;
define ('PROJET_FORUMS_VISIBILITE', 'Forum public') ;
define ('PROJET_OUI', 'oui') ;
define ('PROJET_NON', 'non') ;
define ('PROJET_MESSAGE_LISTE_PRIVEE', 'Cette liste est privée, vous devez être inscrit au projet pour y accéder') ;
?>
<?php
/* +-----------------------------------------------------------------------+
* |pro_langue_fr.inc.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2003 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_fr.inc.php,v 1.16.2.3 2008-04-16 12:42:11 alexandre_tb Exp $
*/
 
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.local.php')) {
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.local.php' ;
}
 
// LA liste des projet
 
define ('PROJET_TEXTE_NON_IDENTIFIE', 'Vous n\'êtes pas identifié. Identifiez-vous pour accéder à vos projets ou pour vous inscrire aux projets') ;
define ('PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE', 'Vous n\'êtes pas identifié. Identifiez-vous pour accéder à la liste des participants') ;
 
// ========== Partie concernant la description su projet =================================
 
define ('PROJET_PROJET', 'Projet') ;
define ('PROJET_PAS_DE_PROJET', 'Il n\'y a aucun projet pour le moment.');
define ("PROJET_ALERTE_TITRE", "Le champs titre ne doit pas &ecirc;tre vide") ;
define ("PROJET_TITRE", "Titre") ;
if (!defined ('PROJET_RESUME')) {
define ('PROJET_RESUME', 'Résumé') ;
}
define ('PROJET_SYNTHESE', 'Synthèse') ;
define ("PROJET_DECONNEXION", "D&eacute;connexion") ;
define ("PROJET_ADMINISTRATION", "Administration") ;
define ("PROJET_ADMINISTRATEUR", 'administrateur') ;
define ("PROJET_NOUVEAU_PROJET", "Nouveau projet") ;
define ('PROJET_ACCUEIL', 'Description du projet') ;
define ('PROJET_PERE', 'Projet père') ;
define ('PROJET_MODIFIER_PROPRIETES', 'Modifier le projet') ;
define ("PROJET_DESTRUCTION_PROJET", "Destruction d'un projet") ;
define ("PROJET_GESTION_UTILISATEUR", "Gérer les participants") ;
define ("PROJET_NOUVEAU_UTILISATEUR", "Nouveau participant") ;
define ('PROJET_NOUVEAU_UTILISATEUR_LAIUS', 'Pour ajouter un participant, inscrivez son adresse mail ci-contre et cliquer sur '.PROJET_NOUVEAU_UTILISATEUR) ;
define ("PROJET_MOD_UTILISATEUR", "Modification d'un utilisateur") ;
define ("PROJET_DESTRUCTION_UTILISATEUR", "Suppression d'un utilisateur") ;
define ("PROJET_VOIR_PROJET", "Voir le projet") ;
define ('PROJET_S_INSCRIRE', 'S\'inscrire') ;
define ('PROJET_SE_DESINSCRIRE_LISTE', 'Se désinscrire') ;
define ('PROJET_SE_DESINSCRIRE_CONFIRMATION', 'Etes vous sûr de vouloir vous désinscrire ?') ;
define ("PROJET_GERER", "G&eacute;rer") ;
define ("PROJET_GERER_FICHIER", "G&eacute;rer fichiers") ;
define ("PROJET_VOIR_FICHIER", "Voir fichiers") ;
define ('PROJET_NOM', 'Nom') ;
define ("PROJET_PRENOM", "Pr&eacute;nom") ;
define ("PROJET_MAIL", "E mail") ;
define ('PROJET_DETAIL_PROJET', 'Détail du projet') ;
define ("PROJET_LABEL_PAYS", "Pays") ;
define ("PROJET_DATE_INSCRIPTION", "Date d'inscription") ;
define ("PROJET_STATUT", "Statut") ;
define ('PROJET_VOUS_ETES', 'Vous êtes ') ;
define ("PROJET_CHEF" ,"Coordonnateur") ;
define ('PROJET_CONTRIBUTEUR', 'Participants') ;
define ('PROJET_NON_INSCRIT', 'non inscrit') ;
define ("PROJET_PAS_D_INSCRIT", "Il n' y a pas d'inscrit à ce projet") ;
define ("PROJET_PARTICIPER", "Les projets auxquels vous participez") ;
define ("PROJET_VOUS_PARTICIPEZ", "Vous participez &agrave; ce projet") ;
define ("PROJET_TOUS", "tous les projets.") ;
define ("PROJET_PROJETS", "projets") ;
define ('PROJET_TYPE', 'Type du projet') ;
define ("PROJET_VOTRE_STATUT", "Votre statut") ;
define ("PROJET_ACTION", "Action") ;
define ('PROJET_SUPPRIMER', 'supprimer') ;
define ('PROJET_SUPPRIMER_LE_PROJET', 'Supprimer le projet') ;
define ('PROJET_SUPPRIMER_PROJET_CONFIRMATION', 'Supprimer le projet ?') ;
define ("PROJET_DESTRUCTION_LAIUS", "La destruction d'un projet implique la suppression de tous les droits ".
"de tous les utilisateurs de ce projet, ainsi que les liens que les autres projets ont ".
"avec lui.") ;
define ("PROJET_DESTRUCTION_EFFECTUEE", "Destruction effectu&eacute;e") ;
define ("PROJET_GESTION_PROJET", "Gestion du projet") ;
define ("PROJET_EN_TANT_QUE", "En tant que") ;
define ("PROJET_INTERVENIR", "vous pouvez intervenir sur les items suivants") ;
define ("PROJET_PROPRIETES", "Propri&eacute;t&eacute;s du projet") ;
define ("PROJET_SELECTIONNER", "S&eacute;lectionner un r&eacute;pertoire cible pour") ;
define ("PROJET_PB_COPIE", "Probl&eagrave;me lors de la copie") ;
define ("PROJET_RETABLISSEMENT", "R&eacute;tablissement de la base de donnée...") ;
define ("PROJET_RETBLISSEMENT_EFFECTUE", "R&eacute;tablissement effectu&eacute;. Vous pouvez r&eacute;essayer.") ;
define ("PROJET_METTRE_FICHIER", "Mettre un fichier en ligne") ;
define ("PROJET_CREER_REP", "Cr&eacute;er un r&eacute;pertoire") ;
define ("PROJET_FICHIERS_ASSOCIES", "Les fichiers associ&eacute;s au projet") ;
define ('PROJET_PAS_DE_DOCUMENTS', 'Pas de documents associés à ce projet') ;
define ("PROJET_FICHIERS_NOM", "Nom") ;
define ("PROJET_FICHIERS_CREE_LE", "Cr&eacute;&eacute; le") ;
define ("PROJET_FICHIERS_PAR", "Par") ;
define ("PROJET_FICHIERS_TAILLE", "Taille") ;
define ("PROJET_RACINE", "Racine") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibilit&eacute;");
define ("PROJET_FICHIERS_ACTION", "Action") ;
define ("PROJET_LEGENDE", "L&eacute;gende") ;
define ("PROJET_LEGENDE_DEPLACE", "D&eacute;place un fichier");
define ("PROJET_LEGENDE_MODIFIE", "Modifie les informations d'un document") ;
define ("PROJET_LEGENDE_SUPPR", "Supprime un fichier");
define ("PROJET_CHAMPS_REQUIS", "D&eacute;signe les champs obligatoires") ;
define ("PROJET_EMAIL", "e-mail") ;
define ("PROJET_MOT_DE_PASSE", "Mot de passe") ;
define ("PROJET_TEXTE_PERDU", "Si vous avez perdu votre mot de passe, indiquer ".
"votre adresse email dans le champs login ci-dessus et cliquez sur \"Valider\"") ;
define ("PROJET_DESCRIPTION", "Description") ;
define ("PROJET_ESPACE_INTERNET", "Espace internet") ;
define ('PROJET_PAS_DE_SITE', 'Pas d\'espace internet externe') ;
define ("PROJET_DESTRUCTION_ALERTE", "Etes-vous sûr de vouloir supprimer ce projet ?") ;
define ("PROJET_MENU_GENERAL", "Menu G&eacute;n&eacute;ral") ;
define ('PROJET_MENU_COORD', 'Menu du coordinateur') ;
define ('PROJET_MENU_CONTRI', 'Menu du Contributeur') ;
define ('PROJET_MENU_OBS', 'Menu de l\'observateur') ;
 
define ('PROJET_CREER_LISTE', 'Créer un forum de discussion') ;
define ('PROJET_LISTE_DE_DISCUSSION', 'Forum de discussion') ;
define ('PROJET_SUPPRIMER_LISTE', 'Supprimer le forum de discussion') ;
define ('PROJET_SUPPRIMER_LISTE_CONFIRMATION', 'Supprimer le forum ?') ;
define ('PROJET_NOM_DE_LA_LISTE', 'Nom du forum') ;
define ('PROJET_NOM_DE_LA_LISTE_REQUIRED', 'Le nom du forum est requis') ;
define ('PROJET_DOMAINE_DE_LA_LISTE', 'Domaine du forum') ;
define ('PROJET_DOMAINE_LISTE_REQUIRED', 'Le domaine est requis') ;
define ('PROJET_MESSAGE_LISTE_DOUBLE', 'Un forum de ce nom la existe déjà') ;
define ('PROJET_PAS_DE_LISTE', 'Pas de forum') ;
define ('PROJET_FORUM', 'Forum') ;
if (!defined ('PROJET_PROPOSER_PROJET')) {
define ('PROJET_PROPOSER_PROJET', '<h1>Proposer un projet</h1><p>');
}
define ('PROJET_RETOUR_RESUME', 'Retour au résumé');
 
define ('PROJET_VOIR_PROFIL', 'Voir le profil de ce participant');
 
define ('PROJET_MODERE', 'Inscription modérée');
define ('PROJET_NON_MODERE', 'Inscription non modérée');
define ('PROJET_INSCRIPTION', 'Inscription') ;
define ('PROJET_DEMANDE_INSCRIPTION', 'Demande d\'inscription au projet');
define ('PROJET_EN_ATTENTE', 'en attente de validation');
 
define ('PROJET_LAIUS_INSCRIPTION_MODERE', 'Votre demande d\'inscription au projet "nom_du_projet" a &eacute;t&eacute; enregistr&eacute;e et
est propos&eacute;e pour acceptation au coordonnateur du projet"<br /><br />
Un accus&eacute; r&eacute;ception vous sera envoy&eacute; à votre courriel d\'inscription
confirmant l\'acception de votre inscription.<br /><br />
Vous pourrez alors acc&eacute;der à toutes les fonctions du projet "nom_du_projet"');
 
// ========== Partie concernant l'upload de fichier =================================
 
define ("PROJET_DOCUMENT_DU_PROJET", "Documents du projet") ;
define ('PROJET_FICHIERS_RECENTS', 'Les derniers documents du projet') ;
define ("PROJET_FICHIER_MISE_EN_LIGNE", "Mise en ligne d'un fichier") ;
define ("PROJET_FICHIER_NOM_DOCUMENT", "Nom du document") ;
define ("PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION", "Saisissez un nom explicite, il correspond ".
"au texte sur lequel il faudra cliquer pour acc&eacute;der au fichier.") ;
define ("PROJET_FICHIER_ALERTE", "Vous devez saisir un nom pour le document") ;
define ("PROJET_FICHIER_DESCRIPTION", "Description") ;
define ("PROJET_FICHIER_PUBLIC", "Tout public") ;
define ("PROJET_FICHIER_PRIVEE", "Projet seulement") ;
define ("PROJET_FICHIER_LE_FICHIER", "Le fichier") ;
define ("PROJET_FICHIER_ALERTE_PAS_DE_FICHIER", "Vous devez sélectionner un fichier") ;
define ("PROJET_FICHIER_CONTINUER", "Continuer") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE_2", "Mise en ligne d'un fichier &eacute;tape 2") ;
define ("PROJET_FICHIER_LABEL", "Label") ;
define ("PROJET_FICHIER_TYPE", "Type") ;
define ("PROJET_FICHIER_TRANSFERT_T", "Transfert termin&eacute;...");
define ("PROJET_FICHIER_VALIDER", "Valider") ;
define ("PROJET_FICHIER_MODIFIER", "Modifier") ;
define ("PROJET_FICHIER_COLLER", "COLLER") ;
define ("PROJET_FICHIER_COUPER", "Déplacer") ;
define ("PROJET_FICHIER_ANNULER", "Annuler") ;
define ("PROJET_FICHIER_SUPPRIMER", "Supprimer") ;
define ('PROJET_CHOISISSEZ_REPERTOIRE', 'Choisissez un répertoire pour ce fichier') ;
define ('PROJET_CHANGER_REPERTOIRE', 'CHANGER UN FICHIER DE REPERTOIRE') ;
define ('PROJET_FICHIER_A_DEPLACER', 'Fichier à déplacer : ') ;
define ('PROJET_DOCUMENT', 'Documents') ;
define ('PROJET_AFFICHAGE_ARBORESCENT', 'Affichage arborescent');
define ('PROJET_AFFICHAGE_CLASSIQUE', 'Affichage classique');
// Création de répertoire
define ("PROJET_REP", "R&eacute;pertoire du projet") ;
define ("PROJET_REP_CREER", "Cr&eacute;ation d'un nouveau r&eacute;pertoire") ;
define ("PROJET_REP_MODIFIER", "Modification d'un r&eacute;pertoire") ;
define ("PROJET_REP_SUPPRIMER", "&ecirc;tes-vous s&ucirc;r de vouloir supprimer le r&eacute;pertoire") ;
 
// ========== Partie concernant les wikini ===========================================
 
define ('PROJET_CREER_WIKI', 'Gestion Wikinis') ;
define ('PROJET_ASSOCIER_WIKI', 'Associer un Wikini');
if (!defined ('PROJET_WIKI_ASSOCIE')) {
define ('PROJET_WIKI_ASSOCIE', 'Espace de rédaction collaborative') ;
}
define ("PROJET_WIKINI_POSSEDE", "Ce projet poss&egrave;de un espace wikini") ;
define ("PROJET_WIKINI_ALLER", "") ;
define ("PROJET_WIKINI_SUPPRIMER", "Supprimer le wikini") ;
define ("PROJET_WIKINI_CHOISIR_NOM", "Choisissez un nom pour le wikini") ;
define ("PROJET_WIKINI_NOM_EXPLICATION", "Le nom doit &ecirc;tre au format wikini, c'est &agrave; dire sans accents, sans espaces et avec au moins deux majuscule. ex MonProjet") ;
define ("PROJET_WIKINI_NOM_INVALIDE", "Ce n'est pas un nom wiki valide") ;
define ("PROJET_WIKINI_NOM_EXISTE", "Il existe d&eacute;j&agrave; un wikini de ce nom la !!") ;
define ("PROJET_WIKINI_PAS", "Pas de Wikini pour ce projet.") ;
define ("PROJET_WIKINI_PAS_REDIR", 'Pour consulter et/ou participer à la rédaction collaborative de ce projet,<br />vous pouvez vous rendre dans le <a class="acceder-outil" href="%s">wikini mis à votre disposition</a>') ;
define ('PROJET_NOM_WIKINI_REQUIS', 'Le nom Wikini est requis') ;
define ('PROJET_PREFIXE_WIKINI', 'Préfixe wikini') ;
define ('PROJET_PREFIXE_WIKINI_REQUIS', 'Le préfixe est requis') ;
if (!defined('PROJET_WIKINI')) {
define ('PROJET_WIKINI', 'Wikini') ;
}
define ("PROJET_NOM_WIKINI", "Nom Wikini") ;
define ("PROJET_PAGE_WIKINI", "Page de démarrage") ;
define ("PROJET_CHOISIR_WIKINI", "Choisir") ;
define ("PROJET_SELECTIONNER_WIKINI", "Selection") ;
 
 
define ("PROJET_LISTE_PARTICIPANT", "Liste des participants") ;
define ("PROJET_LISTE_PARTICIPANT_LAIUS", "Vous &ecirc;tes chef du projet. Vous pouvez &agrave; ce titre, modifier le statut ".
"des participants ou les d&eacute;sinscrire en cas de probl&egrave;me.<br />".
"ttention aux cons&eacute;quences que cela peut avoir...<br />".
"En tant que chef de projet, vous ne pouvez pas modifier votre statut. Si vous souhaitez abandonner ".
"cette fonction, il faut en faire la demande &agrave; l'administrateur du syst&egrave;me&nbsp;&nbsp;") ;
define ("PROJET_DESINSCRIRE_SUR", "&ecirc;tes-vous s&ucirc;r de vouloir d&eacute;sinscrire") ;
define ('PROJET_MAIL_ABSENT', 'L\'email que vous avez saisi n\'est pas dans l\'annuaire') ;
define ('PROJET_ALLER_SUR_WIKINI', 'Entrer dans la page') ;
 
// ========== Labels pour projet_liste ===========================================
 
define ("PROJET_LISTE", "Liste des projets") ;
define ('PROJET_TOUS_LES_PROJETS', 'Les autres projets du réseau') ;
define ("PROJET_NOMBRE_EN_COURS" ,"Nombre de projets en cours") ;
if (!defined ('PROJET_INSCRIT_AUCUN_PROJET')) define ('PROJET_INSCRIT_AUCUN_PROJET', 'Vous n\'êtes inscrit à aucun projet<br />
- <a href="http://www.tela-botanica.org/page:aide_projet">Qu\'est-ce qu\'un projet ?</a><br />
Le réseau Tela Botanica est organisé autour de projets, discussions ou
échanges liés à  la botanique. Vous pouvez y participer en vous
inscrivant.') ;
define ('PROJET_CREATION_LISTE', 'Création d\'un forum de discussion') ;
define ('PROJET_LISTES_EXTERNES_ASSOCIEES', 'Forum associé du projet') ;
define ('PROJET_REFERENCER_LISTE', 'Référencer un forum externe') ;
 
// ========== Labels pour projet_inscription ===========================================
 
define ("PROJET_VOTRE_STATUT_AU_PROJET", "Votre statut par rapport au projet") ;
if (!defined ('PROJET_INSCRIPTION_LISTE_NORMAL')) define ('PROJET_INSCRIPTION_LISTE_NORMAL', 'Je reçois les messages du forum') ;
if (!defined ('PROJET_INSCRIPTION_LISTE_RESUME')) define ('PROJET_INSCRIPTION_LISTE_RESUME', 'Je m\'inscrit à la version résumé du forum') ;
if (!defined ('PROJET_INSCRIPTION_PAS_DE_MAIL')) define ('PROJET_INSCRIPTION_PAS_DE_MAIL', 'Je ne souhaite pas recevoir de messages de ce forum') ;
define ('PROJET_INSCRIPTION_PROJET', 'Inscription au projet') ;
define ('PROJET_S_INSCRIRE_AU_PROJET', 'S\'inscrire au projet') ;
define ('PROJET_MESSAGE_LISTE', 'Messages du forum') ;
define ('PROJET_ADRESSE_ECRIRE', 'Adresse pour écrire au forum') ;
define ('PROJET_TOUS_LES_MESSAGES', 'Tous les messages') ;
define ('PROJET_DERNIERS_MESSAGES', 'Derniers messages du forum du projet') ;
define ('PROJET_DERNIER_MESSAGE', 'Dernier message') ;
define ('PROJET_MESSAGE_DU_MOIS', 'Messages du mois ') ;
define ('PROJET_RECEVOIR_MESSAGES', 'Recevoir les messages') ;
define ('PROJET_NE_PAS_RECEVOIR_MESSAGES', 'Ne plus recevoir de messages') ;
define ('PROJET_MESSAGES_DE', 'Messages de ') ;
define ('PROJET_FILE_DE_DISCUSSION', 'fil de discussion') ;
define ('PROJET_VOUS_N_ETES_PAS_INSCRIT', 'Vous n\'êtes pas inscrit à ce projet') ;
define ('PROJET_VOUS_ETES_PARTICIPANT', 'Vous êtes participant à ce projet') ;
define ('PROJET_SE_DESINSCRIRE', 'Se désinscrire du projet') ;
 
 
// ======================= Labels pour l'envoie d'email ==================================
define ("PROJET_MAIL_TITRE", "Titre") ;
define ("PROJET_MAIL_TITRE_REQUIS", "Vous devez indiquer au moins un titre") ;
define ("PROJET_MAIL_CORPS", "Corps") ;
define ("PROJET_ECRIRE_LISTE", "Ecrire au forum") ;
define ('PROJET_LISTES_ASSOCIEES', 'Forum associé au projet') ;
 
define ('PROJET_RECEVOIR_LES_MESSAGES', 'Recevoir les messages') ;
define ('PROJET_NE_PAS_RECEVOIR', 'Pas de messages') ;
define ('PROJET_RECEVOIR_DES_RESUMES', 'Recevoir des résumés') ;
define ('PROJET_VOUS_ETES_INSCRIT', 'Vous êtes inscrit à ce forum.') ;
define ('PROJET_LISTE_PRIVE', 'Vous devez inscrit pour être');
// Label pour l'affichage des messages dans le forum
define ('PROJET_PRECEDENT', 'précédent') ;
define ('PROJET_SUIVANT', 'suivant') ;
define ('PROJET_REPONDRE', 'répondre') ;
define ('PROJET_REDIGER_REPONSE', 'Rédiger votre réponse') ;
define ('PROJET_FORUMS_VISIBILITE', 'Forum public') ;
define ('PROJET_OUI', 'oui') ;
define ('PROJET_NON', 'non') ;
define ('PROJET_MESSAGE_LISTE_PRIVEE', 'Cette liste est privée, vous devez être inscrit au projet pour y accéder') ;
?>
/trunk/squelettes/rss.tpl.html
File deleted
/trunk/squelettes/document.tpl.html
1,28 → 1,28
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<?php if (!$loggue) : ?><br style="clear:left" /><?php endif; ?>
<?= $bouton_desinscription_projet;?>
<h2><?php echo PROJET_DOCUMENT_DU_PROJET; ?></h2>
 
<?php if ($loggue && ($droits < PROJET_DROIT_AUCUN)) : ?>
<?= $bouton_deposer_doc; ?>
<?= $bouton_creer_repertoire; ?>
<?php endif; ?>
<?php echo $html_no_script; ?>
<?php if ($pas_de_document) : ?>
<p class="information">Ce dossier ne contient pas de documents.</p>
<?php else : ?>
<?php echo $html_document; ?>
<?php endif; ?>
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<?php if (!$loggue) : ?><br style="clear:left" /><?php endif; ?>
<?= $bouton_desinscription_projet;?>
<h2><?php echo PROJET_DOCUMENT_DU_PROJET; ?></h2>
 
<?php if ($loggue && ($droits < PROJET_DROIT_AUCUN)) : ?>
<?= $bouton_deposer_doc; ?>
<?= $bouton_creer_repertoire; ?>
<?php endif; ?>
<?php echo $html_no_script; ?>
<?php if ($pas_de_document) : ?>
<p class="information">Ce dossier ne contient pas de documents.</p>
<?php else : ?>
<?php echo $html_document; ?>
<?php endif; ?>
<br style="clear:both" />
/trunk/squelettes/resume.tpl.html
1,36 → 1,36
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<?php if (isset($message_retour)) echo $message_retour; ?>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<!-- <div id="projet_ou">OU</div>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_login.tpl.html'; ?> -->
<br style="clear:left;" />
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<h2><?= PROJET_RESUME ;?></h2>
<?= $bouton_resume; ?>
 
<div><?= $resume; ?></div>
 
<h2><?= PROJET_WIKI_ASSOCIE ; ?></h2>
<?= $wiki_res ; ?>
<?= $sortie_web ; ?>
<h2><?= PROJET_DERNIERS_MESSAGES ; ?></h2>
<?php if (!$avoir_liste_externe) echo $bouton_poster; ?><br />
<?= $liste_ext_res.$sortie_liste ; ?>
 
<h2><?= PROJET_FICHIERS_RECENTS; ?></h2>
<?= $bouton_deposer_doc; ?>
<?= $vue_liste_document->toHTML('', '') ; ?>
<br style="clear:both" />
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<?php if (isset($message_retour)) echo $message_retour; ?>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<!-- <div id="projet_ou">OU</div>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_login.tpl.html'; ?> -->
<br style="clear:left;" />
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<h2><?= PROJET_RESUME ;?></h2>
<?= $bouton_resume; ?>
 
<div><?= $resume; ?></div>
 
<h2><?= PROJET_WIKI_ASSOCIE ; ?></h2>
<?= $wiki_res ; ?>
<?= $sortie_web ; ?>
<h2><?= PROJET_DERNIERS_MESSAGES ; ?></h2>
<?php if (!$avoir_liste_externe) echo $bouton_poster; ?><br />
<?= $liste_ext_res.$sortie_liste ; ?>
 
<h2><?= PROJET_FICHIERS_RECENTS; ?></h2>
<?= $bouton_deposer_doc; ?>
<?= $vue_liste_document->toHTML('', '') ; ?>
<br style="clear:both" />
<?= $bouton_desinscription_projet;?>
/trunk/squelettes/participants.tpl.html
1,89 → 1,87
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue || $droits == PROJET_DROIT_AUCUN) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<p>
<?php if (!$loggue) : ?>
<?php echo PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE; ?></p>
<?php endif; ?>
</div>
<?php else : ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<br style="clear:left" />
<?= $bouton_desinscription_projet;?>
<h2><?php echo $nombre_participants; ?> participants</h2>
<?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<?php echo PROJET_NOUVEAU_UTILISATEUR_LAIUS ; ?>
<form action="<?php echo $url; ?>" method="post">
<?php if (isset ($msg) && $msg != '') : ?>
<div><?php echo $msg; ?></div>
<?php endif; ?>
<input type="text" name="mail_utilisateur" size="32" />
<input type="submit" value="<?php echo PROJET_NOUVEAU_UTILISATEUR; ?>" />
</form><br />
<?php endif; ?>
<table class="table_cadre">
<tr>
<th>Nom</th>
<th>Pr&eacute;nom</th>
<th>E mail</th>
<th>Date d'inscription</th>
<th>Statut</th>
<th>Forum de discussion</th>
<?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?><th>supprimer</th><?php endif; ?>
</tr>
<?php foreach ($info_utilisateur as $utilisateur) : ?>
<tr class="<?php if ($pair) : ?>ligne_paire<?php $pair = false; ?><?php else : ?>ligne_impaire<?php $pair = true; ?><?php endif; ?>"<?php if ($utilisateur[5] == 1) : ?> style="font-weight:bold;"<?php endif; ?>>
<?php if(defined('PROJET_LIEN_ANNUAIRE') && PROJET_LIEN_ANNUAIRE != '') { ?>
<td><a href="<?php echo PROJET_LIEN_ANNUAIRE.$utilisateur[0] ?>" title="<?php echo PROJET_VOIR_PROFIL ?>"><?php echo $utilisateur[1] ;?></a></td>
<td><a href="<?php echo PROJET_LIEN_ANNUAIRE.$utilisateur[0] ?>" title="<?php echo PROJET_VOIR_PROFIL ?>"><?php echo $utilisateur[2] ;?></a></td>
<?php } else { ?>
<td><?php echo $utilisateur[1] ;?></td>
<td><?php echo $utilisateur[2] ;?></td>
<?php } ?>
<td><a href="mailto:<?php echo $utilisateur[3] ;?>"><?php echo substr($utilisateur[3], 0, 10); ?>...</a></td>
<td><?php echo $utilisateur[4] ;?></td>
<td><?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<?php $this->_url->addQueryString ('id_utilisateur', $utilisateur[0]) ; ?>
<form action="<?php echo $this->_url->getURL(); ?>" method="post">
<select name="statut" onchange="javascript:this.form.submit();">
<?php foreach ($statuts as $cle =>$element_statut) : ?>
<option value="<?php echo $cle ;?>"<?php if ($cle == $utilisateur[5]) : ?> selected="selected"<?php endif; ?>><?php echo $element_statut; ?></option>
<?php endforeach; ?>
</select></form>
<?php else : ?>
<?php echo $statuts[$utilisateur[5]]; ?>
<?php endif; ?>
</td>
<td><?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<form action="<?php echo $this->_url->getURL(); ?>" method="post">
<select name="inscription_liste" onchange="javascript:this.form.submit();">
<option value="0">Non inscrit</option>
<option value="1"<?php echo ($utilisateur[6] ? ' selected="selected"': '');?>>Inscrit</option>
</select></form>
<?php else : ?>
<?php echo $statuts_inscription_liste[$utilisateur[6]]; ?>
<?php endif; ?>
</td>
<?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<td><?php $this->_url->addQueryString ('statut', 4); ?>
<a href="<?php echo $this->_url->getURL(); ?>" onclick="javascript:return confirm('supprimer ?');">supprimer</a>
</td><?php $this->_url->removeQueryString ('statut'); ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>
 
<br style="clear:both" />
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<p><?php echo PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE; ?></p>
</div>
<?php else : ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<br style="clear:left" />
<?= $bouton_desinscription_projet;?>
<h2><?php echo $nombre_participants; ?> participants</h2>
<?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<?php echo PROJET_NOUVEAU_UTILISATEUR_LAIUS ; ?>
<form action="<?php echo $url; ?>" method="post">
<?php if (isset ($msg) && $msg != '') : ?>
<div><?php echo $msg; ?></div>
<?php endif; ?>
<input type="text" name="mail_utilisateur" size="32" />
<input type="submit" value="<?php echo PROJET_NOUVEAU_UTILISATEUR; ?>" />
</form><br />
<?php endif; ?>
<table class="table_cadre">
<tr>
<th>Nom</th>
<th>Pr&eacute;nom</th>
<th>E mail</th>
<th>Date d'inscription</th>
<th>Statut</th>
<th>Forum de discussion</th>
<?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?><th>supprimer</th><?php endif; ?>
</tr>
<?php foreach ($info_utilisateur as $utilisateur) : ?>
<tr class="<?php if ($pair) : ?>ligne_paire<?php $pair = false; ?><?php else : ?>ligne_impaire<?php $pair = true; ?><?php endif; ?>"<?php if ($utilisateur[5] == 1) : ?> style="font-weight:bold;"<?php endif; ?>>
<?php if(defined('PROJET_LIEN_ANNUAIRE') && PROJET_LIEN_ANNUAIRE != '') { ?>
<td><a href="<?php echo PROJET_LIEN_ANNUAIRE.$utilisateur[0] ?>" title="<?php echo PROJET_VOIR_PROFIL ?>"><?php echo $utilisateur[1] ;?></a></td>
<td><a href="<?php echo PROJET_LIEN_ANNUAIRE.$utilisateur[0] ?>" title="<?php echo PROJET_VOIR_PROFIL ?>"><?php echo $utilisateur[2] ;?></a></td>
<?php } else { ?>
<td><?php echo $utilisateur[1] ;?></td>
<td><?php echo $utilisateur[2] ;?></td>
<?php } ?>
<td><a href="mailto:<?php echo $utilisateur[3] ;?>"><?php echo substr($utilisateur[3], 0, 10); ?>...</a></td>
<td><?php echo $utilisateur[4] ;?></td>
<td><?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<?php $this->_url->addQueryString ('id_utilisateur', $utilisateur[0]) ; ?>
<form action="<?php echo $this->_url->getURL(); ?>" method="post">
<select name="statut" onchange="javascript:this.form.submit();">
<?php foreach ($statuts as $cle =>$element_statut) : ?>
<option value="<?php echo $cle ;?>"<?php if ($cle == $utilisateur[5]) : ?> selected="selected"<?php endif; ?>><?php echo $element_statut; ?></option>
<?php endforeach; ?>
</select></form>
<?php else : ?>
<?php echo $statuts[$utilisateur[5]]; ?>
<?php endif; ?>
</td>
<td><?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<form action="<?php echo $this->_url->getURL(); ?>" method="post">
<select name="inscription_liste" onchange="javascript:this.form.submit();">
<option value="0"<?php echo ($utilisateur[6] ? '' : ' selected="selected"');?> >Non inscrit</option>';
<option value="1"<?php echo ($utilisateur[6] ? ' selected="selected"': '');?>>Inscrit</option>
</select></form>
<?php else : ?>
<?php echo $statuts_inscription_liste[$utilisateur[6]]; ?>
<?php endif; ?>
</td>
<?php if ($droits <= PROJET_DROIT_COORDINATEUR) : ?>
<td><?php $this->_url->addQueryString ('statut', 4); ?>
<a href="<?php echo $this->_url->getURL(); ?>" onclick="javascript:return confirm('supprimer ?');">supprimer</a>
</td><?php $this->_url->removeQueryString ('statut'); ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>
 
<br style="clear:both" />
<?php endif; ?>
/trunk/squelettes/description.tpl.html
1,21 → 1,21
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a>En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<h2><?= PROJET_RESUME ;?></h2>
<?= $bouton_resume; ?><br style="clear:left;" />
<div><?= $projet->getResume(); ?></div>
<h2>Description</h2>
<div id="description_projet"><?= $projet->getDescription(); ?></div>
<?= $bouton_desinscription_projet;?>
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a>En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<h2><?= PROJET_RESUME ;?></h2>
<?= $bouton_resume; ?><br style="clear:left;" />
<div><?= $projet->getResume(); ?></div>
<h2>Description</h2>
<div id="description_projet"><?= $projet->getDescription(); ?></div>
<?= $bouton_desinscription_projet;?>
<br style="clear:left;" />
/trunk/squelettes/liste_projet.tpl.html
1,51 → 1,51
<h1>Liste des projets et forums de Tela Botanica</h1>
<div id="projet_choix_mode"><?= $lien_interface_simple; ?>&nbsp;&nbsp;<?= $lien_interface_expert; ?></div>
<div class="projet_recherche"><h2>Rechercher dans les projets</h2>
<form action="<?= $url; ?>" method="get">
<fieldset>
<input type="text" name="projet_recherche" id="projet_recherche" value="<?= $valeur_projet_recherche; ?>" />
<input type="submit" value="Ok" id="projet_recherche_submit" />
</fieldset>
</form>
</div>
<hr />
<div class="information_projet importance4">
<h2>Qu'est-ce qu'un projet ?</h2>
C'est un espace o&ugrave; l'on peut &eacute;changer sur une th&eacute;matique li&eacute;e &agrave; la botanique.
Vous disposez dans cet espace de divers outils.
<ul>
<li><a href="http://www.tela-botanica.org/page:informations_sur_les_projets#infoprojets_utiliser" title="Lien vers l'aide pour utiliser les outils">une liste de discussion (forum)</a></li>
<li><a href="http://www.tela-botanica.org/page:informations_sur_les_projets#infoprojets_utiliser" title="Lien vers l'aide pour utiliser les outils">un wikini</a></li>
<li><a href="http://www.tela-botanica.org/page:informations_sur_les_projets#infoprojets_utiliser" title="Lien vers l'aide pour utiliser les outils">un espace document</a></li>
</ul>
</div>
<div id="cartouche_liste_projet">
<div id="projet_range">Projets <span class="nombre"><?= $range[0]; ?></span> &agrave; <span class="nombre"><?= $range[1]; ?></span> sur <span class="nombre"><?= $nombre_projets; ?></span></div>
 
</div>
<div id="projet_theme">
<h1>Th&egrave;mes - <?= $tableau_theme[$theme_selectionne]['label']; ?></h1>
<ul>
<?php foreach ($tableau_theme as $theme) : ?>
<li><?php if ($theme['id'] == $theme_selectionne) : ?><strong><?php endif; ?>
<a href="<?= $theme['lien']; ?>"><?= $theme['label']; ?></a>
<?php if ($theme['id'] == $theme_selectionne) : ?></strong><?php endif; ?>
( <?= $theme['nombre_projet']; ?> )</li>
<?php endforeach ;?>
</ul>
</div>
<div class="pager"><?= $links['all']; ?></div>
<ul class="liste_projet">
<?php foreach ($tableau_donnees as $projet) : ?>
<li>
<h3><a href="<?= $projet['lien'] ;?>"><?= $projet['titre']; ?></a></h3>
<h4>(<?= $projet['nombre_participants']; ?> participants) <span class="<?= $projet['classe_projet_activite']; ?>">(<?= $projet['activite']; ?>)</span></h4>
<?= $projet['resume']; ?>
<?= $projet['forum'] ; ?>
<?php if ($projet['nombre_message']) : ?>
( + <span class="nombre_message"><?php echo $projet['nombre_message']; ?> nouveaux messages</span> )
<?php endif; ?>
</li>
<?php endforeach ; ?>
</ul>
<h1>Liste des projets et forums de Tela Botanica</h1>
<div id="projet_choix_mode"><?= $lien_interface_simple; ?>&nbsp;&nbsp;<?= $lien_interface_expert; ?></div>
<div class="projet_recherche"><h2>Rechercher dans les projets</h2>
<form action="<?= $url; ?>" method="get">
<fieldset>
<input type="text" name="projet_recherche" id="projet_recherche" value="<?= $valeur_projet_recherche; ?>" />
<input type="submit" value="Ok" id="projet_recherche_submit" />
</fieldset>
</form>
</div>
<hr />
<div class="information_projet importance4">
<h2>Qu'est-ce qu'un projet ?</h2>
C'est un espace o&ugrave; l'on peut &eacute;changer sur une th&eacute;matique li&eacute;e &agrave; la botanique.
Vous disposez dans cet espace de divers outils.
<ul>
<li><a href="http://www.tela-botanica.org/page:informations_sur_les_projets#infoprojets_utiliser" title="Lien vers l'aide pour utiliser les outils">une liste de discussion (forum)</a></li>
<li><a href="http://www.tela-botanica.org/page:informations_sur_les_projets#infoprojets_utiliser" title="Lien vers l'aide pour utiliser les outils">un wikini</a></li>
<li><a href="http://www.tela-botanica.org/page:informations_sur_les_projets#infoprojets_utiliser" title="Lien vers l'aide pour utiliser les outils">un espace document</a></li>
</ul>
</div>
<div id="cartouche_liste_projet">
<div id="projet_range">Projets <span class="nombre"><?= $range[0]; ?></span> &agrave; <span class="nombre"><?= $range[1]; ?></span> sur <span class="nombre"><?= $nombre_projets; ?></span></div>
 
</div>
<div id="projet_theme">
<h1>Th&egrave;mes - <?= $tableau_theme[$theme_selectionne]['label']; ?></h1>
<ul>
<?php foreach ($tableau_theme as $theme) : ?>
<li><?php if ($theme['id'] == $theme_selectionne) : ?><strong><?php endif; ?>
<a href="<?= $theme['lien']; ?>"><?= $theme['label']; ?></a>
<?php if ($theme['id'] == $theme_selectionne) : ?></strong><?php endif; ?>
( <?= $theme['nombre_projet']; ?> )</li>
<?php endforeach ;?>
</ul>
</div>
<div class="pager"><?= $links['all']; ?></div>
<ul class="liste_projet">
<?php foreach ($tableau_donnees as $projet) : ?>
<li>
<h3><a href="<?= $projet['lien'] ;?>"><?= $projet['titre']; ?></a></h3>
<h4>(<?= $projet['nombre_participants']; ?> participants) <span class="<?= $projet['classe_projet_activite']; ?>">(<?= $projet['activite']; ?>)</span></h4>
<?= $projet['resume']; ?>
<?= $projet['forum'] ; ?>
<?php if ($projet['nombre_message']) : ?>
( + <span class="nombre_message"><?php echo $projet['nombre_message']; ?> nouveaux messages</span> )
<?php endif; ?>
</li>
<?php endforeach ; ?>
</ul>
<div class="pager"><?= $links['all']; ?></div>
/trunk/squelettes/message.tpl.html
1,16 → 1,16
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<?php if ($message != PROJET_MESSAGE_LISTE_PRIVEE) : ?>
<h2>Adresse pour &eacute;crire au forum</h2>
<a href="mailto:<?php echo $adresse_envoie; ?>"><?php echo $adresse_envoie; ?></a>
<h2>Message N°<?= $numero_message; ?>/<?= $total_message; ?></h2>
<?php echo $derniers_messages; ?>
<?php echo $navigation; ?>
<?php echo $message; ?>
 
<?php else : ?>
Cette liste est priv&eacute;e, vous devez vous inscrire pour y accéder.
<?php endif; ?>
<?php if ($avoir_liste_externe) : ?>
<h2>Vers l'espace Yahoo !</h2>
<?php echo $liste_ext_res; ?>
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<?php if ($message != PROJET_MESSAGE_LISTE_PRIVEE) : ?>
<h2>Adresse pour &eacute;crire au forum</h2>
<a href="mailto:<?php echo $adresse_envoie; ?>"><?php echo $adresse_envoie; ?></a>
<h2>Message N°<?= $numero_message; ?>/<?= $total_message; ?></h2>
<?php echo $derniers_messages; ?>
<?php echo $navigation; ?>
<?php echo $message; ?>
 
<?php else : ?>
Cette liste est priv&eacute;e, vous devez vous inscrire pour y accéder.
<?php endif; ?>
<?php if ($avoir_liste_externe) : ?>
<h2>Vers l'espace Yahoo !</h2>
<?php echo $liste_ext_res; ?>
<?php endif; ?>
/trunk/squelettes/boutons/bouton_login.tpl.html
1,5 → 1,5
<div id="projet_lien_login"><a>
<img src="client/projet/images/identification.png" />
<span>S'identifier</span></a><br style="clear:both;" />
<!-- PAPYRUS_IDENTIFICATION -->
<div id="projet_lien_login"><a>
<img src="client/projet/images/identification.png" />
<span>S'identifier</span></a><br style="clear:both;" />
<!-- PAPYRUS_IDENTIFICATION -->
</div>
/trunk/squelettes/boutons/bouton_inscription.tpl.html
1,17 → 1,17
<div id="projet_lien_inscription"><a<?php if ($lien_inscription != '#') : ?> href="<?= $lien_inscription; ?>"<?php endif; ?>>
<img src="<?= PROJET_CHEMIN_APPLI; ?>images/inscription.png" alt="" />
<span><?= $label_url_inscription; ?></span>
</a>
</div><br style="clear:both" />
<?php if (!$loggue) : ?>
<div id="projet_bloc_inscription">
<strong>D&eacute;j&agrave; membre de Tela Botanica, identifiez-vous&nbsp;:</strong>
<!-- PAPYRUS_IDENTIFICATION -->
<br />
<strong>Nouveau sur le site : <a href="http://www.tela-botanica.org/inscription">inscrivez-vous au r&eacute;seau Tela Botanica</a></strong>
</div>
<script type="text/javascript">
$("#projet_bloc_inscription").css("display", "none");
</script>
<div id="projet_lien_inscription"><a<?php if ($lien_inscription != '#') : ?> href="<?= $lien_inscription; ?>"<?php endif; ?>>
<img src="<?= PROJET_CHEMIN_APPLI; ?>images/inscription.png" alt="" />
<span><?= $label_url_inscription; ?></span>
</a>
</div><br style="clear:both" />
<?php if (!$loggue) : ?>
<div id="projet_bloc_inscription">
<strong>D&eacute;j&agrave; membre de Tela Botanica, identifiez-vous&nbsp;:</strong>
<!-- PAPYRUS_IDENTIFICATION -->
<br />
<strong>Nouveau sur le site : <a href="http://www.tela-botanica.org/inscription">inscrivez-vous au r&eacute;seau Tela Botanica</a></strong>
</div>
<script type="text/javascript">
$("#projet_bloc_inscription").css("display", "none");
</script>
<?php endif; ?>
/trunk/squelettes/forum.tpl.html
1,43 → 1,43
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<?php if (isset($message_retour)) echo $message_retour; ?>
<?php if ($message != PROJET_MESSAGE_LISTE_PRIVEE) : ?>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<br style="clear:left;" />
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<h2>Adresse pour &eacute;crire au forum</h2>
<a href="mailto:<?php echo $adresse_envoie; ?>"><?php echo $adresse_envoie; ?></a>
<?php if ($avoir_liste_externe) : ?>
<p class="information">La liste de discussion de ce projet est h&eacute;berg&eacute;e par Yahoo Groupes <img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/>.
<br />Pour vous inscrire à cette liste : <a href="mailto:<?php echo $adresse_inscription; ?>"><?php echo $adresse_inscription; ?></a>.<br />
Une fois inscrit, vous pourrez envoyer des messages en utilisant l'adresse pour &eacute;crire au forum (liste de discussion).<br />
Pour plus d'information sur le fonctionnement des Yahoo Groupes, <a href="http://help.yahoo.com/l/fr/yahoo/groups/">http://help.yahoo.com/l/fr/yahoo/groups/</a>.
</p>
<?php endif; ?>
<?php if ($loggue && ($droits < PROJET_DROIT_AUCUN) && !$avoir_liste_externe) echo $bouton_poster; ?>
<br style="clear:left;" />
<h2>Tous les messages</h2>
<?php echo $calendrier; ?>
<h2>Les derniers messages</h2>
<?php echo $derniers_messages; ?>
<?php echo $navigation; ?>
<?php echo $message; ?>
 
<?php else : ?>
Cette liste est priv&eacute;e, vous devez vous inscrire pour y accéder.
<?php endif; ?>
<?php if ($avoir_liste_externe) : ?>
<h2>Vers l'espace Yahoo !</h2>
<?php echo $liste_ext_res; ?>
<?php endif; ?>
<?php echo $bouton_desinscription_liste; ?>
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<?php if (isset($message_retour)) echo $message_retour; ?>
<?php if ($message != PROJET_MESSAGE_LISTE_PRIVEE) : ?>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<br style="clear:left;" />
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a href="<?= $lien_login; ?>">En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<h2>Adresse pour &eacute;crire au forum</h2>
<a href="mailto:<?php echo $adresse_envoie; ?>"><?php echo $adresse_envoie; ?></a>
<?php if ($avoir_liste_externe) : ?>
<p class="information">La liste de discussion de ce projet est h&eacute;berg&eacute;e par Yahoo Groupes <img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/>.
<br />Pour vous inscrire à cette liste : <a href="mailto:<?php echo $adresse_inscription; ?>"><?php echo $adresse_inscription; ?></a>.<br />
Une fois inscrit, vous pourrez envoyer des messages en utilisant l'adresse pour &eacute;crire au forum (liste de discussion).<br />
Pour plus d'information sur le fonctionnement des Yahoo Groupes, <a href="http://help.yahoo.com/l/fr/yahoo/groups/">http://help.yahoo.com/l/fr/yahoo/groups/</a>.
</p>
<?php endif; ?>
<?php if ($loggue && ($droits < PROJET_DROIT_AUCUN) && !$avoir_liste_externe) echo $bouton_poster; ?>
<br style="clear:left;" />
<h2>Tous les messages</h2>
<?php echo $calendrier; ?>
<h2>Les derniers messages</h2>
<?php echo $derniers_messages; ?>
<?php echo $navigation; ?>
<?php echo $message; ?>
 
<?php else : ?>
Cette liste est priv&eacute;e, vous devez vous inscrire pour y accéder.
<?php endif; ?>
<?php if ($avoir_liste_externe) : ?>
<h2>Vers l'espace Yahoo !</h2>
<?php echo $liste_ext_res; ?>
<?php endif; ?>
<?php echo $bouton_desinscription_liste; ?>
<br style="clear:left;" />
/trunk/squelettes/liste_projet_expert.tpl.html
1,66 → 1,66
<h1>Liste des projets et forums de Tela Botanica</h1>
<div id="projet_choix_mode"><?= $lien_interface_simple; ?>&nbsp;&nbsp;<?= $lien_interface_expert; ?></div>
<h2><a href="javascript:animatedcollapse.toggle('legende');">L&eacute;gende (ouvrir / fermer)</a></h2>
<div id="legende">
A Chaque ligne du tableau correspond un projet, les diff&eacute;rentes colonnes donnent des indications sur les projets.
<h3>Les forums</h3>
<p>L'ic&ocirc;ne <img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/> indique qu'un liste Yahoo ! est associée &agrave; ce projet.
Le nombre entre parenth&egrave;ses indique le nombre de messages &eacute;chang&eacute; sur ce forum cette semaine.</p>
<p>L'ic&ocirc;ne <img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /> indique un liste de discussion associ&eacute;e
au projet et h&eacute;berg&eacute;e par Tela Botanica. Le nombre entre parenth&egrave;ses indique le nombre de nouveaux messages de la semaine.</p>
<h3>Lien vers les flux RSS</h3>
Les flux RSS <img src="sites/commun/generique/images/rss.gif" alt="rss"/> (Ressource Site Summary), vous permettent de suivre les mises &agrave; jour des wikinis associ&eacute;s au projet.
Tout comme les listes de discussion, le nombre entre parenth&egrave;ses indique si des modifications ont eu lieu cette derni&egrave;re semaine.
<a href="http://fr.wikipedia.org/wiki/Flux_RSS"> Plus d'informations sur les flux RSS</a>.
<h3>Le nombre de participants</h3>
<p>Le nombre de participants est soit :</p>
<ul><li>le nombre de participants au projet, si la liste de discussion associ&eacute;e est h&eacute;berg&eacute;e par Tela Botanica</li>
<li>le nombre d'inscrits &agrave; la liste Yahoo!, si la liste est h&eacute;berg&eacute;e par Yahoo!</li>
</ul>
<p>Le nombre entre parenth&egrave;s indique les nouveaux inscrits de la semaine.</p>
<h3>L'activit&eacute;</h3>
<p>Le pourcentage d'activit&eacute; est calcul&eacute; &agrave; partir d'&eacute;l&eacute;ments de la derni&egrave;re semaine :</p>
<ul><li>Le nombre de messages &eacute;chang&eacute;s</li>
<li>Les modifications sur les Wikinis</li>
<li>Les nouveaux documents</li>
<li>Les nouveaux inscrits au projet</li>
</ul>
<?php if ($loggue) : ?>
<h3>Votre inscription</h3>
<p>Lorsque vous &ecirc;tes identifi&eacute; sur le site de Tela Botanica, une colonne intitul&eacute;e "Votre inscription" s'affiche. Elle permet de voir rapidement les projets auxquels vous êtes inscrit et votre statut dans ces projets :</p>
<ul>
<li>Une &eacute;toile verte <img src="http://www.tela-botanica.org/client/projet/icones/etoile_verte.png" alt="étoile verte" /> indique que vous &ecirc;tes <b>Participant</b> &agrave; ce projet.</li>
<li>Une &eacute;toile rouge <img src="http://www.tela-botanica.org/client/projet/icones/etoile_rouge.png" alt="étoile rouge" /> signale que vous êtes <b>Coordonnateur</b> de ce projet.</li>
<li>Une &eacute;toile grise <img src="http://www.tela-botanica.org/client/projet/icones/etoile_grise.png" alt="étoile verte" /> signifie que vous avez demand&eacute; votre inscription &agrave; ce projet et que votre demande est <b>en attente de validation</b> par un mod&eacute;rateur.</li>
</ul>
<?php endif; ?>
</div>
<script type="text/javascript">
$("#legende").css("display", "none");
</script>
<div id="cartouche_liste_projet">
<div id="projet_range">Projets <span class="nombre"><?= $range[0]; ?></span> &agrave; <span class="nombre"><?= $range[1]; ?></span> sur <span class="nombre"><?= $nombre_projets; ?></span></div>
 
</div>
 
<table class="table_cadre" id="table_projet" summary="Liste des projets">
<tr><th><a href="<?= $lien_tri_titre ; ?>" class="<?= $enteteTri['p_titre']->getClasse(); ?>">Titre</a></th><th>Forum</th><th>Wiki</th><th>RSS</th>
<th><a href="<?= $lien_tri_doc;?>" class="<?= $enteteTri['ps_doc_derniere_semaine']->getClasse(); ?>">Documents</a></th>
<th><a href="<?= $lien_tri_participants; ?>" class="<?= $enteteTri['ps_nombre_inscrit']->getClasse(); ?>">Participants</a></th>
<th><a href="<?= $lien_tri_activite ; ?>" class="<?= $enteteTri['ps_pourcent']->getClasse(); ?>">Activit&eacute;</a></th>
<?php if ($loggue) : ?><th><a href="<?= $lien_tri_statut ; ?>" class="<?= $enteteTri['psu_id_statut']->getClasse(); ?>">Votre inscription</a></th><?php endif; ?>
</tr>
<?php foreach ($tableau_donnees as $projet) : ?>
<tr <?php if ($pair) {echo ' class="ligne_paire"'; $pair = false; } else { echo 'class="ligne_impaire"'; $pair = true;} ?>>
<td><a href="<?= $projet['lien'] ;?>"><?= $projet['titre']; ?></a></td>
<td><?= $projet['forum'] ; ?><?php if ($projet['nombre_message']) : ?><span title="Nombres de messages échangés cette semaine">( + <?php echo $projet['nombre_message']; ?> )</span><?php endif; ?></td>
<td><?= $projet['wikini'] ; ?></td>
<td><?= $projet['wikini_rss'] ; ?></td>
<td><?= $projet['document'] ; ?></td>
<td><a href="<?= $projet['lien_participants'];?>"><?= $projet['nombre_participants'];?></a> <?= $projet['ps_nombre_inscrit_derniere_semaine']; ?></td>
<td><?= $projet['activite'] ; ?></td>
<?php if ($loggue) :?><td style="text-align:center;"><?php echo $projet['statut_icone']; ?></td><?php endif; ?>
</tr>
<?php endforeach ; ?>
</table>
<h1>Liste des projets et forums de Tela Botanica</h1>
<div id="projet_choix_mode"><?= $lien_interface_simple; ?>&nbsp;&nbsp;<?= $lien_interface_expert; ?></div>
<h2><a href="javascript:animatedcollapse.toggle('legende');">L&eacute;gende (ouvrir / fermer)</a></h2>
<div id="legende">
A Chaque ligne du tableau correspond un projet, les diff&eacute;rentes colonnes donnent des indications sur les projets.
<h3>Les forums</h3>
<p>L'ic&ocirc;ne <img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/> indique qu'un liste Yahoo ! est associée &agrave; ce projet.
Le nombre entre parenth&egrave;ses indique le nombre de messages &eacute;chang&eacute; sur ce forum cette semaine.</p>
<p>L'ic&ocirc;ne <img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /> indique un liste de discussion associ&eacute;e
au projet et h&eacute;berg&eacute;e par Tela Botanica. Le nombre entre parenth&egrave;ses indique le nombre de nouveaux messages de la semaine.</p>
<h3>Lien vers les flux RSS</h3>
Les flux RSS <img src="sites/commun/generique/images/rss.gif" alt="rss"/> (Ressource Site Summary), vous permettent de suivre les mises &agrave; jour des wikinis associ&eacute;s au projet.
Tout comme les listes de discussion, le nombre entre parenth&egrave;ses indique si des modifications ont eu lieu cette derni&egrave;re semaine.
<a href="http://fr.wikipedia.org/wiki/Flux_RSS"> Plus d'informations sur les flux RSS</a>.
<h3>Le nombre de participants</h3>
<p>Le nombre de participants est soit :</p>
<ul><li>le nombre de participants au projet, si la liste de discussion associ&eacute;e est h&eacute;berg&eacute;e par Tela Botanica</li>
<li>le nombre d'inscrits &agrave; la liste Yahoo!, si la liste est h&eacute;berg&eacute;e par Yahoo!</li>
</ul>
<p>Le nombre entre parenth&egrave;s indique les nouveaux inscrits de la semaine.</p>
<h3>L'activit&eacute;</h3>
<p>Le pourcentage d'activit&eacute; est calcul&eacute; &agrave; partir d'&eacute;l&eacute;ments de la derni&egrave;re semaine :</p>
<ul><li>Le nombre de messages &eacute;chang&eacute;s</li>
<li>Les modifications sur les Wikinis</li>
<li>Les nouveaux documents</li>
<li>Les nouveaux inscrits au projet</li>
</ul>
<?php if ($loggue) : ?>
<h3>Votre inscription</h3>
<p>Lorsque vous &ecirc;tes identifi&eacute; sur le site de Tela Botanica, une colonne intitul&eacute;e "Votre inscription" s'affiche. Elle permet de voir rapidement les projets auxquels vous êtes inscrit et votre statut dans ces projets :</p>
<ul>
<li>Une &eacute;toile verte <img src="http://www.tela-botanica.org/client/projet/icones/etoile_verte.png" alt="étoile verte" /> indique que vous &ecirc;tes <b>Participant</b> &agrave; ce projet.</li>
<li>Une &eacute;toile rouge <img src="http://www.tela-botanica.org/client/projet/icones/etoile_rouge.png" alt="étoile rouge" /> signale que vous êtes <b>Coordonnateur</b> de ce projet.</li>
<li>Une &eacute;toile grise <img src="http://www.tela-botanica.org/client/projet/icones/etoile_grise.png" alt="étoile verte" /> signifie que vous avez demand&eacute; votre inscription &agrave; ce projet et que votre demande est <b>en attente de validation</b> par un mod&eacute;rateur.</li>
</ul>
<?php endif; ?>
</div>
<script type="text/javascript">
$("#legende").css("display", "none");
</script>
<div id="cartouche_liste_projet">
<div id="projet_range">Projets <span class="nombre"><?= $range[0]; ?></span> &agrave; <span class="nombre"><?= $range[1]; ?></span> sur <span class="nombre"><?= $nombre_projets; ?></span></div>
 
</div>
 
<table class="table_cadre" id="table_projet" summary="Liste des projets">
<tr><th><a href="<?= $lien_tri_titre ; ?>" class="<?= $enteteTri['p_titre']->getClasse(); ?>">Titre</a></th><th>Forum</th><th>Wiki</th><th>RSS</th>
<th><a href="<?= $lien_tri_doc;?>" class="<?= $enteteTri['ps_doc_derniere_semaine']->getClasse(); ?>">Documents</a></th>
<th><a href="<?= $lien_tri_participants; ?>" class="<?= $enteteTri['ps_nombre_inscrit']->getClasse(); ?>">Participants</a></th>
<th><a href="<?= $lien_tri_activite ; ?>" class="<?= $enteteTri['ps_pourcent']->getClasse(); ?>">Activit&eacute;</a></th>
<?php if ($loggue) : ?><th><a href="<?= $lien_tri_statut ; ?>" class="<?= $enteteTri['psu_id_statut']->getClasse(); ?>">Votre inscription</a></th><?php endif; ?>
</tr>
<?php foreach ($tableau_donnees as $projet) : ?>
<tr <?php if ($pair) {echo ' class="ligne_paire"'; $pair = false; } else { echo 'class="ligne_impaire"'; $pair = true;} ?>>
<td><a href="<?= $projet['lien'] ;?>"><?= $projet['titre']; ?></a></td>
<td><?= $projet['forum'] ; ?><?php if ($projet['nombre_message']) : ?><span title="Nombres de messages échangés cette semaine">( + <?php echo $projet['nombre_message']; ?> )</span><?php endif; ?></td>
<td><?= $projet['wikini'] ; ?></td>
<td><?= $projet['wikini_rss'] ; ?></td>
<td><?= $projet['document'] ; ?></td>
<td><a href="<?= $projet['lien_participants'];?>"><?= $projet['nombre_participants'];?></a> <?= $projet['ps_nombre_inscrit_derniere_semaine']; ?></td>
<td><?= $projet['activite'] ; ?></td>
<?php if ($loggue) :?><td style="text-align:center;"><?php echo $projet['statut_icone']; ?></td><?php endif; ?>
</tr>
<?php endforeach ; ?>
</table>
/trunk/squelettes/mes_projets.tpl.html
1,29 → 1,29
<h1>Liste des projets et forums de Tela Botanica</h1>
 
<p class="importance4">
Les projets en dormance sont affichés seulement sur l'interface <em>"expert"</em>.
Si vous souhaitez visualiser tous les projets auxquels vous êtes inscrit, passez en mode <em>"expert"</em>.
<span id="projet_choix_mode"><?= $lien_interface_simple; ?>&nbsp;&nbsp;<?= $lien_interface_expert; ?></span>
</p>
<div id="cartouche_liste_projet">
<div id="projet_range">
Projets <span class="nombre"><?= $range[0]; ?></span>
&agrave; <span class="nombre"><?= $range[1]; ?></span>
sur <span class="nombre"><?= $nombre_projets; ?></span>
</div>
</div>
<div class="pager"><?= $links['all']; ?></div>
<ul class="liste_projet">
<?php foreach ($tableau_donnees as $projet) : ?>
<li>
<h3><a href="<?= $projet['lien'] ;?>"><?= $projet['titre']; ?></a></h3>
<h4>(<?= $projet['nombre_participants']; ?> participants) <span class="<?= $projet['classe_projet_activite']; ?>">(<?= $projet['activite']; ?>)</span></h4>
<?= $projet['resume']; ?>
<?= $projet['forum'] ; ?>
<?php if ($projet['nombre_message']) : ?>
( + <span class="nombre_message"><?php echo $projet['nombre_message']; ?> nouveaux messages</span> )
<?php endif; ?>
</li>
<?php endforeach ; ?>
</ul>
<h1>Liste des projets et forums de Tela Botanica</h1>
 
<p class="importance4">
Les projets en dormance sont affichés seulement sur l'interface <em>"expert"</em>.
Si vous souhaitez visualiser tous les projets auxquels vous êtes inscrit, passez en mode <em>"expert"</em>.
<span id="projet_choix_mode"><?= $lien_interface_simple; ?>&nbsp;&nbsp;<?= $lien_interface_expert; ?></span>
</p>
<div id="cartouche_liste_projet">
<div id="projet_range">
Projets <span class="nombre"><?= $range[0]; ?></span>
&agrave; <span class="nombre"><?= $range[1]; ?></span>
sur <span class="nombre"><?= $nombre_projets; ?></span>
</div>
</div>
<div class="pager"><?= $links['all']; ?></div>
<ul class="liste_projet">
<?php foreach ($tableau_donnees as $projet) : ?>
<li>
<h3><a href="<?= $projet['lien'] ;?>"><?= $projet['titre']; ?></a></h3>
<h4>(<?= $projet['nombre_participants']; ?> participants) <span class="<?= $projet['classe_projet_activite']; ?>">(<?= $projet['activite']; ?>)</span></h4>
<?= $projet['resume']; ?>
<?= $projet['forum'] ; ?>
<?php if ($projet['nombre_message']) : ?>
( + <span class="nombre_message"><?php echo $projet['nombre_message']; ?> nouveaux messages</span> )
<?php endif; ?>
</li>
<?php endforeach ; ?>
</ul>
<div class="pager"><?= $links['all']; ?></div>
/trunk/squelettes/wikini.tpl.html
1,16 → 1,16
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a>En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<br style="clear:left;" />
<?php echo $wiki_res; ?>
 
<h1><?= PROJET_PROJET ; ?> : <?= $projet->getTitre(); ?></h1>
<div id="projet_bloc_action">
<?php if (!$loggue) : ?>
<?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?>
<?php endif; ?>
<?php if ($loggue && $droits == PROJET_DROIT_AUCUN) : ?><?php include_once PROJET_CHEMIN_APPLI.'squelettes/boutons/bouton_inscription.tpl.html'; ?><br style="clear:both;" /><?php endif; ?>
<?php if ($droits == PROJET_DROIT_EN_ATTENTE) : ?>
<div id="projet_lien_login">
<a>En attente de validation</a>
<p><?= $laius_inscription_modere; ?></p>
</div>
<?php endif; ?>
</div>
<br style="clear:left;" />
<?php echo $wiki_res; ?>
 
/trunk/actions/resume.php
1,324 → 1,324
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: resume.php,v 1.13 2007-08-28 10:33:50 alexandre_tb Exp $
/**
* Application projet
*
* Action resume
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.13 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
$retour = '';
$loggue = false;
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
 
/** Bloc resume avec lien resume */
$resume = $projet->getResume();
$bouton_resume = '';
$bouton_s_inscrire_au_projet = '';
 
 
$lien_inscription = '';
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet) ;
 
// creation de la vue liste de document, on nettoie l'url
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;
$vue_liste_document = new HTML_listeDocuments($this->_url, false, '', $this->_auth) ;
$bouton_deposer_doc = '';
// reglage de parametres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
$bouton_poster = '';
$bouton_desinscription_projet = '';
 
// verification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
 
if ($this->_auth->getAuth()) {
$loggue = true;
$droits = PROJET_DROIT_AUCUN;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
 
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
$projet->getListesAssociees();
foreach ($projet->_listes_associes as $info_liste) {
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = 'S\'inscrire &agrave; la liste' ;
} else {
// L'action envoyer un mail
$action_inscription = PROJET_ENVOYER_UN_MAIL ;
$label_inscription = PROJET_ECRIRE_LISTE ;
}
}
 
switch ($participant->getStatut($id_u, $this->_id_projet))
{
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
 
break;
case PROJET_DROIT_CONTRIBUTEUR :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$bouton_deposer_doc .= '<br style="clear:both" />';
 
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
$bouton_desinscription_projet .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
break;
case PROJET_DROIT_COORDINATEUR || PROJET_DROIT_ADMINISTRATEUR :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
$bouton_resume .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$bouton_deposer_doc .= '<br style="clear:both" />';
 
if ($projet->avoirListe()) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
 
}
 
break;
case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
'element = $(\'projet_lien_login\');'."\n".
'element.addEvent(
\'click\', function() {
fx.start({
\'height\' : \'320px\'
})
}
)});');
$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
$lien_login = '#';
break;
}
$bouton_poster .= '<br style="clear:both" />';
 
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
 
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
$visible = true ;
} else {
$visible = false ;
}
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
 
 
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
 
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$lien_login = '#';
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $this->_db) ;
 
$wiki_res = '' ;
// Les wikinis associes au projet
if ($wiki = $projet->getWikini()) {
if (strpos($wiki, "http://www.tela-botanica.org/wikini/") === 0) {// Si le wiki, ne peut pas être intégré
$wiki_res .= '<div style="line-height: 2em;">'.sprintf(PROJET_WIKINI_PAS_REDIR, $wiki).'</div>'."\n";
} else {
$url = $GLOBALS['_GEN_commun']['url'] ;
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link = $this->_url->getURL();
$wiki_res .= '<div><a href="'.$link.'">'.PROJET_ALLER_SUR_WIKINI.'</a> ('.$wiki.')</div>';
}
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n";
}
// On charge les listes de discussion du projet
// Pour le moment seul ezmlm est supportee
 
$projet->getListesAssociees();
$sortie_liste = '' ;
 
 
$liste_ext_res = '' ;
if ($projet->avoirListe()) {
ob_start() ;
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
foreach ($projet->_listes_associes as $info_liste) {
$liste = new ezmlm_php() ;
// Param�trage de la liste
 
$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
 
$liste->listname = $info_liste->getNom() ;
$liste->listdomain = $info_liste->getDomaine();
 
if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
$liste->set_action($GLOBALS['action']) ;
$liste->set_actionargs($GLOBALS['actionargs']) ;
} else {
$liste->set_action('list_info') ;
}
$liste->sendheaders = false;
$liste->sendbody = false;
$liste->sendfooters = false;
$liste->forcehref = $this->_url->getURL() ;
 
 
 
if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
switch ($liste->action) {
case "list_info":
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
$xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
$info_liste->getNom(), $GLOBALS['lang'],
$this->_url->getURL()) ;
 
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$derniers_messages = ob_get_contents() ;
ob_end_clean();
echo $derniers_messages ;
break;
}
} else {
print PROJET_MESSAGE_LISTE_PRIVEE;
}
$sortie_liste = ob_get_contents() ;
ob_end_clean() ;
}
}
 
// Site internet associe
$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
if ($projet->getEspaceInternet() != '') {
$sortie_web .= '<a href="'.$projet->getEspaceInternet().'">'.$projet->getEspaceInternet().'</a>'."\n" ;
} else {
$sortie_web .= PROJET_PAS_DE_SITE ;
}
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
 
if (count ($tableau_liste) != 0) {
$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
//$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
//$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
$liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
//$liste_ext_res .= '<br />'."\n" ;
}
$avoir_liste_externe = true;
} else {
$avoir_liste_externe = false;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre();
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/resume.tpl.html';
 
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: resume.php,v 1.13 2007-08-28 10:33:50 alexandre_tb Exp $
/**
* Application projet
*
* Action resume
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.13 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
$retour = '';
$loggue = false;
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
 
/** Bloc resume avec lien resume */
$resume = $projet->getResume();
$bouton_resume = '';
$bouton_s_inscrire_au_projet = '';
 
 
$lien_inscription = '';
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet) ;
 
// creation de la vue liste de document, on nettoie l'url
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;
$vue_liste_document = new HTML_listeDocuments($this->_url, false, '', $this->_auth) ;
$bouton_deposer_doc = '';
// reglage de parametres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
$bouton_poster = '';
$bouton_desinscription_projet = '';
 
// verification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
 
if ($this->_auth->getAuth()) {
$loggue = true;
$droits = PROJET_DROIT_AUCUN;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
 
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
$projet->getListesAssociees();
foreach ($projet->_listes_associes as $info_liste) {
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = 'S\'inscrire &agrave; la liste' ;
} else {
// L'action envoyer un mail
$action_inscription = PROJET_ENVOYER_UN_MAIL ;
$label_inscription = PROJET_ECRIRE_LISTE ;
}
}
 
switch ($participant->getStatut($id_u, $this->_id_projet))
{
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
 
break;
case PROJET_DROIT_CONTRIBUTEUR :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$bouton_deposer_doc .= '<br style="clear:both" />';
 
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
$bouton_desinscription_projet .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
break;
case PROJET_DROIT_COORDINATEUR || PROJET_DROIT_ADMINISTRATEUR :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
$bouton_resume .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$bouton_deposer_doc .= '<br style="clear:both" />';
 
if ($projet->avoirListe()) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
 
}
 
break;
case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
'element = $(\'projet_lien_login\');'."\n".
'element.addEvent(
\'click\', function() {
fx.start({
\'height\' : \'320px\'
})
}
)});');
$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
$lien_login = '#';
break;
}
$bouton_poster .= '<br style="clear:both" />';
 
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
 
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
$visible = true ;
} else {
$visible = false ;
}
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
 
 
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
 
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$lien_login = '#';
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $this->_db) ;
 
$wiki_res = '' ;
// Les wikinis associes au projet
if ($wiki = $projet->getWikini()) {
if (strpos($wiki, "http://www.tela-botanica.org/wikini/") === 0) {// Si le wiki, ne peut pas être intégré
$wiki_res .= '<div style="line-height: 2em;">'.sprintf(PROJET_WIKINI_PAS_REDIR, $wiki).'</div>'."\n";
} else {
$url = $GLOBALS['_GEN_commun']['url'] ;
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link = $this->_url->getURL();
$wiki_res .= '<div><a href="'.$link.'">'.PROJET_ALLER_SUR_WIKINI.'</a> ('.$wiki.')</div>';
}
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n";
}
// On charge les listes de discussion du projet
// Pour le moment seul ezmlm est supportee
 
$projet->getListesAssociees();
$sortie_liste = '' ;
 
 
$liste_ext_res = '' ;
if ($projet->avoirListe()) {
ob_start() ;
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
foreach ($projet->_listes_associes as $info_liste) {
$liste = new ezmlm_php() ;
// Param�trage de la liste
 
$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
 
$liste->listname = $info_liste->getNom() ;
$liste->listdomain = $info_liste->getDomaine();
 
if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
$liste->set_action($GLOBALS['action']) ;
$liste->set_actionargs($GLOBALS['actionargs']) ;
} else {
$liste->set_action('list_info') ;
}
$liste->sendheaders = false;
$liste->sendbody = false;
$liste->sendfooters = false;
$liste->forcehref = $this->_url->getURL() ;
 
 
 
if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
switch ($liste->action) {
case "list_info":
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
$xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
$info_liste->getNom(), $GLOBALS['lang'],
$this->_url->getURL()) ;
 
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$derniers_messages = ob_get_contents() ;
ob_end_clean();
echo $derniers_messages ;
break;
}
} else {
print PROJET_MESSAGE_LISTE_PRIVEE;
}
$sortie_liste = ob_get_contents() ;
ob_end_clean() ;
}
}
 
// Site internet associe
$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
if ($projet->getEspaceInternet() != '') {
$sortie_web .= '<a href="'.$projet->getEspaceInternet().'">'.$projet->getEspaceInternet().'</a>'."\n" ;
} else {
$sortie_web .= PROJET_PAS_DE_SITE ;
}
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
 
if (count ($tableau_liste) != 0) {
$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
//$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
//$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
$liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
//$liste_ext_res .= '<br />'."\n" ;
}
$avoir_liste_externe = true;
} else {
$avoir_liste_externe = false;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre();
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/resume.tpl.html';
 
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/trunk/actions/documents.php
1,175 → 1,175
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: documents.php,v 1.10 2007-10-02 09:24:53 alexandre_tb Exp $
/**
* Application projet
*
* Action documents
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.10 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
if (!isset($retour)) $retour = '';
 
$bouton_deposer_doc = '';
$bouton_creer_repertoire = '';
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// recuperation de la liste des documents associes
 
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $this->_id_repertoire) ;
 
//$html_document = print_r($liste_documents, true);
// creation de la vue liste de document, on nettoie l'url
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
 
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
 
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
if (count ($liste_documents) == 0) $pas_de_document = true;
 
// reglage de parametres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
 
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
 
// verification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
$loggue = false;
if ($this->_auth->getAuth()) {
$loggue = true;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$droits = $participant->getStatut($id_u, $this->_id_projet);
 
// si participant, on ajoute le champs visibilite
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
}
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
if ($droit <= PROJET_DROIT_CONTRIBUTEUR ) {
array_push ($entete_liste, PROJET_ACTION) ;
}
switch ($droits)
{
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
break;
}
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$bouton_deposer_doc .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE);
$bouton_creer_repertoire = bouton::toHTML($this->_url->getURL(), 'Cr&eacute;er un r&eacute;pertoire', 'repertoire');
$bouton_creer_repertoire .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT);
} else {
$droits = PROJET_DROIT_AUCUN ;
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$label_url_inscription = 'S\'inscrire &agrave; au projet';
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
 
 
// Les liens pour l affichage classique ou arborescent (avec dojo)
$this->_url->addQueryString('affichage', 'ajax');
$url_ajax = $this->_url->getURL();
$this->_url->addQueryString('affichage', 'standart');
$url_classique = $this->_url->getURL();
$this->_url->removeQueryString('affichage');
 
$arbre = document::getArbreDocument($this->_id_projet) ;
 
if (!isset ($_SESSION['mode_affichage'])) {
if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'standart';
} else {
if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
}
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
 
$html_no_script = '';
if ($vue_liste_document->_mode_affichage == 'ajax') {
$html_no_script .= '<noscript>';
$vue_liste_document->setModeAffichage('standart');
$html_no_script .= $vue_liste_document->toHTML('', '') ;
$html_no_script .= '</noscript>';
}
 
 
$html_document .= $vue_liste_document->toHTML($projet->getId(), $droits);
$this->_url->removeQueryString(PROJET_VARIABLE_SERVICE);
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DOCUMENT;
 
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/document.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: documents.php,v 1.11 2008-08-25 15:02:49 alexandre_tb Exp $
/**
* Application projet
*
* Action documents
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.11 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
if (!isset($retour)) $retour = '';
 
$bouton_deposer_doc = '';
$bouton_creer_repertoire = '';
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// recuperation de la liste des documents associes
 
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $this->_id_repertoire) ;
 
//$html_document = print_r($liste_documents, true);
// creation de la vue liste de document, on nettoie l'url
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
 
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
 
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
if (count ($liste_documents) == 0) $pas_de_document = true;
 
// reglage de parametres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
 
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
 
// verification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
$loggue = false;
if ($this->_auth->getAuth()) {
$loggue = true;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$droits = $participant->getStatut($id_u, $this->_id_projet);
 
// si participant, on ajoute le champs visibilite
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
}
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
if ($droit <= PROJET_DROIT_CONTRIBUTEUR ) {
array_push ($entete_liste, PROJET_ACTION) ;
}
switch ($droits)
{
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
break;
}
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$bouton_deposer_doc .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE);
$bouton_creer_repertoire = bouton::toHTML($this->_url->getURL(), 'Cr&eacute;er un r&eacute;pertoire', 'repertoire');
$bouton_creer_repertoire .= '<br style="clear:both" />';
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT);
} else {
$droits = PROJET_DROIT_AUCUN ;
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$label_url_inscription = 'S\'inscrire &agrave; au projet';
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
 
 
// Les liens pour l affichage classique ou arborescent (avec dojo)
$this->_url->addQueryString('affichage', 'ajax');
$url_ajax = $this->_url->getURL();
$this->_url->addQueryString('affichage', 'standart');
$url_classique = $this->_url->getURL();
$this->_url->removeQueryString('affichage');
 
$arbre = document::getArbreDocument($this->_id_projet) ;
 
if (!isset ($_SESSION['mode_affichage'])) {
if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'standart';
} else {
if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
}
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
 
$html_no_script = '';
if ($vue_liste_document->_mode_affichage == 'ajax') {
$html_no_script .= '<noscript>';
$vue_liste_document->setModeAffichage('standart');
$html_no_script .= $vue_liste_document->toHTML('', '') ;
$html_no_script .= '</noscript>';
}
 
 
$html_document .= $vue_liste_document->toHTML($projet->getId(), $droits);
$this->_url->removeQueryString(PROJET_VARIABLE_SERVICE);
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DOCUMENT;
 
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/document.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/actions/participants.php
1,211 → 1,211
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participants.php,v 1.8 2008-08-25 15:02:49 alexandre_tb Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
$res = '' ;
$pair = true;
$loggue = $this->_auth->getAuth();
$url = $this->_url->getURL();
 
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
//$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise a jour de statut
if (isset($_REQUEST['statut'])) {
$participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
// Si d�sinscription de l'utilisateur (statut 4)
if ($_REQUEST['statut'] == 4) {
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($_GET['id_utilisateur']) ;
// on d�sinscrit l'utilisateur des listes associ�es au projet
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($this->_db) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
}
// On teste ici s'il y a une mise a jour de l inscription a la liste
if (isset($_POST['inscription_liste'])) {
$projet->getListesAssociees();
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($_GET['id_utilisateur']) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$inscription= new inscription_liste($this->_db) ;
if ($_POST['inscription_liste'] == 1) {
$inscription->inscrireUtilisateur($annuaire, $projet->_listes_associes[0], 2) ; // 2 est le statut d inscription normale
} else {
$inscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
if (isset($_POST['mail_utilisateur'])) {
$requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$msg = PROJET_MAIL_ABSENT;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
// Le statut 2 est le statut participant
$participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
}
}
 
if ($this->_auth->getAuth()) {
$statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
if ($statut == 4) {
$droits = PROJET_DROIT_AUCUN ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
}
if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
$res = PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
$res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
if (isset ($msg) && $msg != '') {
$res .= '<div>'.$msg.'</div>' ;
}
$res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
$res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
$res .= '</form><br />'."\n" ;
}
// Mise en place de l'url
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
// Construction de l'entete
$info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
$nombre_participants = count ($info_utilisateur);
 
include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
if ($projet->avoirListe()) {
/** recuperation des abonnees a la liste */
include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php';
$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_listes_associes[0]->getDomaine(),
$projet->_listes_associes[0]->getNom());
$ezmlm->load();
$tableau_mail = $ezmlm->parse();
 
for ($i = 0; $i < count ($info_utilisateur); $i++) {
$tableau_mail_utilisateur[$info_utilisateur[$i][3]] = $i;
$info_utilisateur[$i][6] = 0; // Initialisation du tableau avec la valeur 0
}
foreach ($tableau_mail->children() as $email) {
$email = (string) $email;
if (isset($tableau_mail_utilisateur[$email])) {
$id = (int) $tableau_mail_utilisateur[$email];
$info_utilisateur[$id][6] = 1;
}
}
}
$statuts = statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db);
$statuts_inscription_liste[0] = 'non inscrit';
$statuts_inscription_liste[1] = 'inscrit';
} else {
$droits = PROJET_DROIT_AUCUN ;
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$lien_login = '#';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
}
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_LISTE_PARTICIPANT;
//$retour .= $titre.$res.$xml; ;
 
 
 
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/participants.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
 
 
$this->_url->removeQueryString ('statut');
$this->_url->removeQueryString ('id_utilisateur');
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: participants.php,v $
* Revision 1.8 2008-08-25 15:02:49 alexandre_tb
* mise en place des squelettes
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participants.php,v 1.9 2008-09-01 14:38:34 alexandre_tb Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
$res = '' ;
$pair = true;
$loggue = $this->_auth->getAuth();
$url = $this->_url->getURL();
 
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
//$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise a jour de statut
if (isset($_REQUEST['statut'])) {
$participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
// Si désinscription de l'utilisateur (statut 4)
if ($_REQUEST['statut'] == 4) {
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($_GET['id_utilisateur']) ;
// on désinscrit l'utilisateur des listes associées au projet
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($this->_db) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
}
// On teste ici s'il y a une mise a jour de l inscription a la liste
if (isset($_POST['inscription_liste'])) {
$projet->getListesAssociees();
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($_GET['id_utilisateur']) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$inscription= new inscription_liste($this->_db) ;
if ($_POST['inscription_liste'] == 1) {
$inscription->inscrireUtilisateur($annuaire, $projet->_listes_associes[0], 2) ; // 2 est le statut d inscription normale
} else {
$inscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
if (isset($_POST['mail_utilisateur'])) {
$requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$msg = PROJET_MAIL_ABSENT;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
// Le statut 2 est le statut participant
$participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
}
}
 
if ($this->_auth->getAuth()) {
$statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
if ($statut == 4) {
$droits = PROJET_DROIT_AUCUN ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
}
if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
$res = PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
$res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
if (isset ($msg) && $msg != '') {
$res .= '<div>'.$msg.'</div>' ;
}
$res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
$res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
$res .= '</form><br />'."\n" ;
}
// Mise en place de l'url
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
// Construction de l'entete
$info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
$nombre_participants = count ($info_utilisateur);
include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
if ($projet->avoirListe()) {
/** recuperation des abonnees a la liste */
include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php';
$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_listes_associes[0]->getDomaine(),
$projet->_listes_associes[0]->getNom());
$ezmlm->load();
$tableau_mail = $ezmlm->parse();
 
for ($i = 0; $i < count ($info_utilisateur); $i++) {
$tableau_mail_utilisateur[$info_utilisateur[$i][3]] = $i;
$info_utilisateur[$i][6] = 0; // Initialisation du tableau avec la valeur 0
}
foreach ($tableau_mail->children() as $email) {
$email = (string) $email;
if (isset($tableau_mail_utilisateur[$email])) {
$id = (int) $tableau_mail_utilisateur[$email];
$info_utilisateur[$id][6] = 1;
}
}
}
$statuts = statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db);
$statuts_inscription_liste[0] = 'non inscrit';
$statuts_inscription_liste[1] = 'inscrit';
} else {
$droits = PROJET_DROIT_AUCUN ;
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$lien_login = '#';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
}
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_LISTE_PARTICIPANT;
//$retour .= $titre.$res.$xml; ;
 
 
 
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/participants.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
 
 
$this->_url->removeQueryString ('statut');
$this->_url->removeQueryString ('id_utilisateur');
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.8 2008-08-25 15:02:49 alexandre_tb
* mise en place des squelettes
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/actions/description.php
1,169 → 1,171
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
/**
* Application projet
*
* Action description
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
if ($this->_auth->getAuth()) {
$loggue = true;
$droits = PROJET_DROIT_AUCUN;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
 
switch ($participant->getStatut($id_u, $this->_id_projet))
{
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> <div id="projet_lien_inscription">
<a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>
</div>';
break;
case PROJET_DROIT_CONTRIBUTEUR :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
break;
case PROJET_DROIT_COORDINATEUR :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
break;
case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
'element = $(\'projet_lien_login\');'."\n".
'element.addEvent(
\'click\', function() {
fx.start({
\'height\' : \'320px\'
})
}
)});');
$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
$lien_login = '#';
break;
}
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
$visible = true ;
} else {
$visible = false ;
}
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
 
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$lien_login = '#';
}
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DESCRIPTION;
 
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/description.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
 
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: description.php,v 1.4 2008-08-25 15:02:35 alexandre_tb Exp $
/**
* Application projet
*
* Action description
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
if ($this->_auth->getAuth()) {
$loggue = true;
$droits = PROJET_DROIT_AUCUN;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
 
switch ($participant->getStatut($id_u, $this->_id_projet))
{
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> <div id="projet_lien_inscription">
<a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>
</div>';
break;
case PROJET_DROIT_CONTRIBUTEUR :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
break;
case PROJET_DROIT_COORDINATEUR :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
break;
case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
'element = $(\'projet_lien_login\');'."\n".
'element.addEvent(
\'click\', function() {
fx.start({
\'height\' : \'320px\'
})
}
)});');
$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
$lien_login = '#';
break;
}
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
$visible = true ;
} else {
$visible = false ;
}
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
 
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
// recuperation de la liste des documents associes
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
$lien_login = '#';
}
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DESCRIPTION;
 
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/description.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/actions/wikini.php
1,131 → 1,131
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: wikini.php,v 1.17 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.17 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
$droits = PROJET_DROIT_AUCUN ;
$res = '' ;
$loggue = $this->_auth->getAuth();
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$lien_inscription = PROJET_LIEN_INSCRIPTION_CMS;
 
$wiki_res = '' ;
$script_wiki = '$(document).ready(function() {
$(\'#projet_lien_inscription\').bind(\'click\', function() {
$(\'#projet_bloc_inscription\').toggle();
return false;
});
});';
GEN_stockerCodeScript($script_wiki);
// Les wikinis associes au projet
 
if ($loggue) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$droits = $participant->getStatut($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet);
switch ($droits) {
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = "S'inscrire &agrave; ce projet";
break;
}
}
if ($wiki = $projet->getWikini()) {
// Si le wiki, ne peut pas �tre int�gr�
if (strpos($wiki, "http://www.tela-botanica.org/wikini/") === 0) {
$wiki_res .= '<div style="line-height: 2em;">'.sprintf(PROJET_WIKINI_PAS_REDIR, $wiki).'</div>'."\n" ;
} else {
if ($projet->isModere()) {
if ($this->_auth->getAuth()) {
if ($participant->getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $projet->getId(), $this->_db) < 3) {
$wiki_res .= '<a href="http://'.$GLOBALS['_GEN_commun']['url']->host.'/'.
PROJET_CHEMIN_WIKINI.$projet->getWikini().'">'.PROJET_WIKINI_ALLER.'</a>';
$GLOBALS['_GEN_commun']['info_application']->wikini = $wiki;
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ACTION,'wikini');
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ID_PROJET,$this->_id_projet);
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
$wiki_res.= afficherPageWikini();
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_MENU'] =afficherPageMenuWikini();
 
} else {
$wiki_res .= PROJET_VOUS_N_ETES_PAS_INSCRIT;
}
} else {
$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> '.
'<div id="projet_lien_inscription">'.
'<a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>'.
'</div>';
$loggue = false;
$wiki_res .= PROJET_TEXTE_NON_IDENTIFIE;
}
} else {
$wiki_res .= '<a href="http://'.$GLOBALS['_GEN_commun']['url']->host.'/'.
PROJET_CHEMIN_WIKINI.$projet->getWikini().'" target="_blank" id="aller_sur_wikini">'.
PROJET_WIKINI_ALLER.'</a>';
$GLOBALS['_GEN_commun']['info_application']->wikini = $wiki;
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ACTION,'wikini');
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ID_PROJET,$this->_id_projet);
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
$wiki_res.= afficherPageWikini();
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_MENU'] = afficherPageMenuWikini();
}
}
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n";
}
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_WIKINI;
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/wikini.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: wikini.php,v 1.17 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.17 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
$droits = PROJET_DROIT_AUCUN ;
$res = '' ;
$loggue = $this->_auth->getAuth();
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$lien_inscription = PROJET_LIEN_INSCRIPTION_CMS;
 
$wiki_res = '' ;
$script_wiki = '$(document).ready(function() {
$(\'#projet_lien_inscription\').bind(\'click\', function() {
$(\'#projet_bloc_inscription\').toggle();
return false;
});
});';
GEN_stockerCodeScript($script_wiki);
// Les wikinis associes au projet
 
if ($loggue) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$droits = $participant->getStatut($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet);
switch ($droits) {
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = "S'inscrire &agrave; ce projet";
break;
}
}
if ($wiki = $projet->getWikini()) {
// Si le wiki, ne peut pas être intégré
if (strpos($wiki, "http://www.tela-botanica.org/wikini/") === 0) {
$wiki_res .= '<div style="line-height: 2em;">'.sprintf(PROJET_WIKINI_PAS_REDIR, $wiki).'</div>'."\n" ;
} else {
if ($projet->isModere()) {
if ($this->_auth->getAuth()) {
if ($participant->getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $projet->getId(), $this->_db) < 3) {
$wiki_res .= '<a href="http://'.$GLOBALS['_GEN_commun']['url']->host.'/'.
PROJET_CHEMIN_WIKINI.$projet->getWikini().'">'.PROJET_WIKINI_ALLER.'</a>';
$GLOBALS['_GEN_commun']['info_application']->wikini = $wiki;
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ACTION,'wikini');
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ID_PROJET,$this->_id_projet);
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
$wiki_res.= afficherPageWikini();
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_MENU'] =afficherPageMenuWikini();
 
} else {
$wiki_res .= PROJET_VOUS_N_ETES_PAS_INSCRIT;
}
} else {
$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> '.
'<div id="projet_lien_inscription">'.
'<a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>'.
'</div>';
$loggue = false;
$wiki_res .= PROJET_TEXTE_NON_IDENTIFIE;
}
} else {
$wiki_res .= '<a href="http://'.$GLOBALS['_GEN_commun']['url']->host.'/'.
PROJET_CHEMIN_WIKINI.$projet->getWikini().'" target="_blank" id="aller_sur_wikini">'.
PROJET_WIKINI_ALLER.'</a>';
$GLOBALS['_GEN_commun']['info_application']->wikini = $wiki;
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ACTION,'wikini');
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ID_PROJET,$this->_id_projet);
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
$wiki_res.= afficherPageWikini();
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_MENU'] = afficherPageMenuWikini();
}
}
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n";
}
 
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_WIKINI;
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/wikini.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
?>
/trunk/actions/forums.php
1,407 → 1,406
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: forums.php,v 1.13 2008-08-25 15:02:49 alexandre_tb Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.13 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php' ;
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
 
// creation de l'objet projet courant
$projet = new projet ($this->_db, $this->_id_projet) ;
 
/* contiendra le lien vers la liste yahoo */
$liste_ext_res = '' ;
 
$url_page_en_cours = $this->_url->getURL();
 
$inscription_laius ='' ;
$bouton_poster = '';
$bouton_desinscription_liste = '';
 
$loggue = $this->_auth->getAuth();
 
// Un appel a papyrus pour modifier le titre de la page
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_FORUM;
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
 
if (count ($tableau_liste) != 0) {
//$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
$liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
$liste_ext_res .= '<br />'."\n" ;
}
$avoir_liste_externe = true;
$adresse_envoie = $info_liste->AGO_A_MAILSEND;
$adresse_inscription = $info_liste->AGO_A_MAILABO;
} else {
$avoir_liste_externe = false;
}
 
 
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet);
if ($projet->avoirListe()) {
foreach ($projet->_listes_associes as $info_liste) {
ob_start() ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
if ($this->_auth->getAuth()) {
$participant = new participe($this->_db) ;
$droits = $participant->getStatut($id_u, $this->_id_projet);
} else {
$droits = PROJET_DROIT_AUCUN;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
}
switch ($droits) {
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
break;
}
// gestion de l'inscription desinscription a la liste
// TODO : la gestion de linscription au resume
$inscription_liste = new inscription_liste($this->_db) ;
$statut = $inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth ) ;
if ($this->_auth->getAuth() && isset($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
if ($statut == 2) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;
$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;
} else {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);
$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;
$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;
}
}
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = 'S\'inscrire &agrave; la liste' ;
} else {
// L'action envoyer un mail
$action_inscription = PROJET_ENVOYER_UN_MAIL ;
$label_inscription = PROJET_ECRIRE_LISTE ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
$bouton_desinscription_liste = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire de la liste','cross');
}
if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
$liste = new ezmlm_php() ;
// Parametrage de la liste
$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
$liste->listname = $info_liste->getNom() ;
$liste->listdomain = $info_liste->getDomaine();
if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
$liste->set_action($GLOBALS['action']) ;
$liste->set_actionargs($GLOBALS['actionargs']) ;
} else {
$liste->set_action('list_info') ;
}
$liste->sendheaders = false;
$liste->sendbody = false;
$liste->sendfooters = false;
$liste->forcehref = $this->_url->getURL() ;
if (!$avoir_liste_externe) {
$adresse_envoie = $info_liste->getAdresseEnvoi();
}
print '<a href="mailto:'.$adresse_envoie.'">' . $adresse_envoie ;
print "</a><br />\n";
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum))
print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';
print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM);
if ($liste->action != 'show_message') {
$xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
$info_liste->getNom(), $GLOBALS['lang'],
$this->_url->getURL()) ;
$xml_parser->load();
ob_start();
$resultat = $xml_parser->parse() ;
$calendrier = ob_get_contents();
ob_end_clean();
$xml_parser->reset();
 
}
//$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
// On teste si l'on vient d'une reponse a un email, si oui
// on modifie $liste->action pour renvoyer le message auquelon vient de repondre
if (isset($_POST['messageid'])) {
$liste->action = 'show_msg' ;
}
switch ($liste->action) {
case "show_msg":
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
// actionargs[0] contient le nom du repertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$xml_parser->setAction ('message');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$mail = ob_get_contents() ;
ob_end_clean();
$mimeDecode = new Mail_mimeDecode($mail) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true',
'include_bodies' => 'true')) ;
$message = new ezmlm_msgdisplay() ;
$message->listname = $info_liste->getNom();
$numero_message = $xml_parser->getNumeroMessage();
$total_message = $xml_parser->getNombreTotalMessage();
$this->_url->addQueryString ('action', 'show_msg');
ob_start();
if ($xml_parser->getNumeroFichierPrecedent() != 0) {
$lien_precedent = $this->_url->getURL(). '&amp;actionargs[]='.
$xml_parser->getNumeroRepertoirePrecedent().'&amp;actionargs[]='.
$xml_parser->getNumeroFichierPrecedent();
$bouton_precedent = bouton::toHTML($lien_precedent, PROJET_PRECEDENT, 'gauche', 'projet_bouton_inline');
$navigation = $bouton_precedent;
}
if ($xml_parser->getNumeroFichierSuivant() != '' && (int) $numero_message < (int) $total_message) {
$lien_suivant = $this->_url->getURL(). '&amp;actionargs[]='.
$xml_parser->getNumeroRepertoireSuivant().'&amp;actionargs[]='.
$xml_parser->getNumeroFichierSuivant();
$bouton_suivant = bouton::toHTML($lien_suivant ,PROJET_SUIVANT, 'droite', 'projet_bouton_inline');
$navigation .= $bouton_suivant;
}
$this->_url->addQueryString ('action', 'repondre');
$bouton_repondre = bouton::toHTML($this->_url->getURL().'&amp;actionargs[]='.$liste->actionargs[0].
'&amp;actionargs[]='.$liste->actionargs[1], PROJET_REPONDRE, 'repondre', 'projet_bouton_inline');
$this->_url->removeQueryString('action');
/*
Un bouton pour revenir a la liste des messages
*/
$navigation .= bouton::toHTML($this->_url->getURL() ,'retour', 'haut', 'projet_bouton_inline');
if (!$avoir_liste_externe && $droits <= PROJET_DROIT_CONTRIBUTEUR) $navigation .= $bouton_repondre;
if ($droits == PROJET_DROIT_COORDINATEUR || $droits == PROJET_DROIT_ADMINISTRATEUR) {
$this->_url->addQueryString ('action', 'supprimer');
 
$bouton_suppression_message = bouton::toHTML($this->_url->getURL().'&amp;actionargs[]='.$liste->actionargs[0].
'&amp;actionargs[]='.$liste->actionargs[1], 'Supprimer', 'cross', 'projet_bouton_inline');
$navigation .= $bouton_suppression_message;
}
$this->_url->removeQueryString ('action');
print '<div class="message">' ;
print $message->parse_entete_mail($mailDecode) ;
$message->parse_template($mailDecode, $liste->actionargs[1], $liste->actionargs[0]);
print $message->message_rendu;
print '</div>' ;
$message = ob_get_contents();
ob_end_clean();
break;
case "list_info":
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$derniers_messages = ob_get_contents() ;
ob_end_clean();
 
break;
case "show_threads":
$xml_parser->reset() ;
$xml_parser->setAction ('messages_thread');
$xml_parser->setMois($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_thread = ob_get_contents() ;
ob_end_clean();
$message = $messages_thread ;
break;
case "show_author_msgs" :
$xml_parser->reset() ;
$xml_parser->setAction ('messages_auteur');
$xml_parser->setHashAuteur($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_auteur = ob_get_contents() ;
ob_end_clean();
$message = $messages_auteur ;
break;
case 'show_month' :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, 'forums');
$this->_url->addQueryString('action', 'show_threads');
$this->_url->addQueryString('actionargs[]', $liste->actionargs[0]);
$message = '[<a href="'.$this->_url->getURL().'">par fil de discussion</a>]';
$xml_parser->reset() ;
$xml_parser->setAction ('messages_mois');
$xml_parser->setMois($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_mois = ob_get_contents() ;
ob_end_clean();
$message .= $messages_mois ;
break;
case 'repondre' :
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
$xml_parser->setAction ('message');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$message = ob_get_contents() ;
ob_end_clean();
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
if (isset($_SESSION['formulaire_mail'])) {
unset ($_SESSION['formulaire_mail']) ;
}
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post',
str_replace('&amp;', '&', $this->_url->getURL()).
'&action='.PROJET_ENVOYER_UN_MAIL_V.
'&actionargs[]='.$liste->actionargs[0].
'&actionargs[]='.$liste->actionargs[1].
'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$repondre = new ezmlm_repondre();
$repondre->listdir = $liste->listdir ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
$repondre->forcehref = $this->_url->getURL();
$repondre->listname = $info_liste->getNom() ;
// actionargs[0] contient le nom du r�pertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$message = '<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
$repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
$repondre->parse_template($mailDecode, $liste->actionargs[0], $liste->actionargs[1]);
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au d�but de chaque ligne du message
$tableau = explode ("\n", $repondre->message_rendu) ;
$repondre->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $repondre->message_rendu,
'mail_titre' => 'Re : '.$repondre->decode_iso ($mailDecode->headers['subject']))) ;
$message .= $formulaireReponse->toHTML() ;
 
break;
case 'supprimer' :
$xml_parser->reset() ;
$xml_parser->setAction ('supprimer');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
$message = '<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$message .= ob_get_contents() ;
ob_end_clean();
break;
}
} else {
$message = PROJET_MESSAGE_LISTE_PRIVEE ;
}
ob_end_clean() ;
}
}
 
 
if ($liste->action == 'show_msg') $squelette = 'message'; else $squelette = 'forum';
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/'.$squelette.'.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
 
 
$this->_url->removeQueryString ('actionargs');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM);
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: forums.php,v $
* Revision 1.13 2008-08-25 15:02:49 alexandre_tb
* mise en place des squelettes
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: forums.php,v 1.14 2008-09-16 14:12:43 alexandre_tb Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.14 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php' ;
// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//
 
 
// creation de l'objet projet courant
$projet = new projet ($this->_db, $this->_id_projet) ;
 
/* contiendra le lien vers la liste yahoo */
$liste_ext_res = '' ;
 
$url_page_en_cours = $this->_url->getURL();
 
$inscription_laius ='' ;
$bouton_poster = '';
$bouton_desinscription_liste = '';
 
$loggue = $this->_auth->getAuth();
 
// Un appel a papyrus pour modifier le titre de la page
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_FORUM;
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
 
if (count ($tableau_liste) != 0) {
//$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
$liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
$liste_ext_res .= '<br />'."\n" ;
}
$avoir_liste_externe = true;
$adresse_envoie = $info_liste->AGO_A_MAILSEND;
$adresse_inscription = $info_liste->AGO_A_MAILABO;
} else {
$avoir_liste_externe = false;
}
 
 
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet);
if ($projet->avoirListe()) {
foreach ($projet->_listes_associes as $info_liste) {
ob_start() ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
if ($this->_auth->getAuth()) {
$participant = new participe($this->_db) ;
$droits = $participant->getStatut($id_u, $this->_id_projet);
} else {
$droits = PROJET_DROIT_AUCUN;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
}
switch ($droits) {
case PROJET_DROIT_AUCUN :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$lien_inscription = $this->_url->getURL();
$label_url_inscription = 'S\'inscrire &agrave; ce projet';
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
break;
}
// gestion de l'inscription desinscription a la liste
// TODO : la gestion de linscription au resume
$inscription_liste = new inscription_liste($this->_db) ;
$statut = $inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth ) ;
if ($this->_auth->getAuth() && isset($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
if ($statut == 2) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;
$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;
} else {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);
$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;
$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;
}
}
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = 'S\'inscrire &agrave; la liste' ;
} else {
// L'action envoyer un mail
$action_inscription = PROJET_ENVOYER_UN_MAIL ;
$label_inscription = PROJET_ECRIRE_LISTE ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
$bouton_desinscription_liste = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire de la liste','cross');
}
if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
$liste = new ezmlm_php() ;
// Parametrage de la liste
$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
$liste->listname = $info_liste->getNom() ;
$liste->listdomain = $info_liste->getDomaine();
if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
$liste->set_action($GLOBALS['action']) ;
$liste->set_actionargs($GLOBALS['actionargs']) ;
} else {
$liste->set_action('list_info') ;
}
$liste->sendheaders = false;
$liste->sendbody = false;
$liste->sendfooters = false;
$liste->forcehref = $this->_url->getURL() ;
if (!$avoir_liste_externe) {
$adresse_envoie = $info_liste->getAdresseEnvoi();
}
print '<a href="mailto:'.$adresse_envoie.'">' . $adresse_envoie ;
print "</a><br />\n";
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum))
print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';
print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM);
if ($liste->action != 'show_message') {
$xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
$info_liste->getNom(), $GLOBALS['lang'],
$this->_url->getURL()) ;
$xml_parser->load();
ob_start();
$resultat = $xml_parser->parse() ;
$calendrier = ob_get_contents();
ob_end_clean();
$xml_parser->reset();
}
//$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
// On teste si l'on vient d'une reponse a un email, si oui
// on modifie $liste->action pour renvoyer le message auquelon vient de repondre
if (isset($_POST['messageid'])) {
$liste->action = 'show_msg' ;
}
switch ($liste->action) {
case "show_msg":
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
// actionargs[0] contient le nom du repertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$xml_parser->setAction ('message');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$mail = ob_get_contents() ;
ob_end_clean();
$mimeDecode = new Mail_mimeDecode($mail) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true',
'include_bodies' => 'true')) ;
$message = new ezmlm_msgdisplay() ;
$message->listname = $info_liste->getNom();
$numero_message = $xml_parser->getNumeroMessage();
$total_message = $xml_parser->getNombreTotalMessage();
$this->_url->addQueryString ('action', 'show_msg');
ob_start();
if ($xml_parser->getNumeroFichierPrecedent() != 0) {
$lien_precedent = $this->_url->getURL(). '&amp;actionargs[]='.
$xml_parser->getNumeroRepertoirePrecedent().'&amp;actionargs[]='.
$xml_parser->getNumeroFichierPrecedent();
$bouton_precedent = bouton::toHTML($lien_precedent, PROJET_PRECEDENT, 'gauche', 'projet_bouton_inline');
$navigation = $bouton_precedent;
}
if ($xml_parser->getNumeroFichierSuivant() != '' && (int) $numero_message < (int) $total_message) {
$lien_suivant = $this->_url->getURL(). '&amp;actionargs[]='.
$xml_parser->getNumeroRepertoireSuivant().'&amp;actionargs[]='.
$xml_parser->getNumeroFichierSuivant();
$bouton_suivant = bouton::toHTML($lien_suivant ,PROJET_SUIVANT, 'droite', 'projet_bouton_inline');
$navigation .= $bouton_suivant;
}
$this->_url->addQueryString ('action', 'repondre');
$bouton_repondre = bouton::toHTML($this->_url->getURL().'&amp;actionargs[]='.$liste->actionargs[0].
'&amp;actionargs[]='.$liste->actionargs[1], PROJET_REPONDRE, 'repondre', 'projet_bouton_inline');
$this->_url->removeQueryString('action');
/*
Un bouton pour revenir a la liste des messages
*/
$navigation .= bouton::toHTML($this->_url->getURL() ,'retour', 'haut', 'projet_bouton_inline');
if (!$avoir_liste_externe && $droits <= PROJET_DROIT_CONTRIBUTEUR) $navigation .= $bouton_repondre;
if ($droits == PROJET_DROIT_COORDINATEUR || $droits == PROJET_DROIT_ADMINISTRATEUR) {
$this->_url->addQueryString ('action', 'supprimer');
 
$bouton_suppression_message = bouton::toHTML($this->_url->getURL().'&amp;actionargs[]='.$liste->actionargs[0].
'&amp;actionargs[]='.$liste->actionargs[1], 'Supprimer', 'cross', 'projet_bouton_inline');
$navigation .= $bouton_suppression_message;
}
$this->_url->removeQueryString ('action');
print '<div class="message">' ;
print $message->parse_entete_mail($mailDecode) ;
$message->parse_template($mailDecode, $liste->actionargs[1], $liste->actionargs[0]);
print $message->message_rendu;
print '</div>' ;
$message = ob_get_contents();
ob_end_clean();
break;
case "list_info":
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$derniers_messages = ob_get_contents() ;
ob_end_clean();
 
break;
case "show_threads":
$xml_parser->reset() ;
$xml_parser->setAction ('messages_thread');
$xml_parser->setMois($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_thread = ob_get_contents() ;
ob_end_clean();
$message = $messages_thread ;
break;
case "show_author_msgs" :
$xml_parser->reset() ;
$xml_parser->setAction ('messages_auteur');
$xml_parser->setHashAuteur($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_auteur = ob_get_contents() ;
ob_end_clean();
$message = $messages_auteur ;
break;
case 'show_month' :
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, 'forums');
$this->_url->addQueryString('action', 'show_threads');
$this->_url->addQueryString('actionargs[]', $liste->actionargs[0]);
$message = '[<a href="'.$this->_url->getURL().'">par fil de discussion</a>]';
$xml_parser->reset() ;
$xml_parser->setAction ('messages_mois');
$xml_parser->setMois($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_mois = ob_get_contents() ;
ob_end_clean();
$message .= $messages_mois ;
break;
case 'repondre' :
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
$xml_parser->setAction ('message');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$message = ob_get_contents() ;
ob_end_clean();
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
if (isset($_SESSION['formulaire_mail'])) {
unset ($_SESSION['formulaire_mail']) ;
}
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post',
str_replace('&amp;', '&', $this->_url->getURL()).
'&action='.PROJET_ENVOYER_UN_MAIL_V.
'&actionargs[]='.$liste->actionargs[0].
'&actionargs[]='.$liste->actionargs[1].
'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$repondre = new ezmlm_repondre();
$repondre->listdir = $liste->listdir ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
$repondre->forcehref = $this->_url->getURL();
$repondre->listname = $info_liste->getNom() ;
// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$message = '<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
$repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
$repondre->parse_template($mailDecode, $liste->actionargs[0], $liste->actionargs[1]);
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au début de chaque ligne du message
$tableau = explode ("\n", $repondre->message_rendu) ;
$repondre->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $repondre->message_rendu,
'mail_titre' => 'Re : '.$repondre->decode_iso ($mailDecode->headers['subject']))) ;
$message .= $formulaireReponse->toHTML() ;
 
break;
case 'supprimer' :
$xml_parser->reset() ;
$xml_parser->setAction ('supprimer');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
$message = '<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$message .= ob_get_contents() ;
ob_end_clean();
break;
}
} else {
$message = PROJET_MESSAGE_LISTE_PRIVEE ;
}
ob_end_clean() ;
}
}
 
 
if ($liste->action == 'show_msg') $squelette = 'message'; else $squelette = 'forum';
ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/'.$squelette.'.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
 
 
$this->_url->removeQueryString ('actionargs');
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM);
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.13 2008-08-25 15:02:49 alexandre_tb
* mise en place des squelettes
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/images/ago-tbgs.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-exemple.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/icon_sort_up.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-thymusvulg.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-Phytolacca_americana.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-phaeoceros.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/icon_sort_dwn.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-thymus.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/identification.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-orch.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/inscription.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-botanorm.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-anthillys.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-corsinia.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-thelipt.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-tbpteri.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-anoviti.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-colchique.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/icon_sort.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-arenaria.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-lichens.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-philonotis.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-exemple.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-drosera.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-sbf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-tropic.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-carex.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-bartramia.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-messicoles.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-pellia.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-Ophrys_pectus.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-sorbus.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/ago-po66.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/identification.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/barre_blanche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/branche_droite.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/inscription.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/piece_jointe.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/branche_gauche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/tronc.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/bouton.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/feuille.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/valider.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/arbre.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/feuille_droite.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/fleche_droite.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/bouton_survol.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/haut.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/images/racine.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/projet.modification.inc.php
1,83 → 1,83
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.modification.inc.php,v 1.4 2008-09-16 14:10:06 alexandre_tb Exp $
/**
* Inscription
*
* Le fichier de modification de projet, appele par l'inscription
* en cas de modification d'un utilisateur
*
*@package projet
//Auteur original :
*@author Aurelien Peronnet <aurelien@tela-botanica.org>
*@copyright Tela-Botanica 2000-2006
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// On recupere id_utilisateur, l'identifiant de la personne qui se desinscrit
// On se trouve dans la fonction afficherContenuCorps de inscription.php
 
 
 
include_once 'client/projet/configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
$participant = new participe($GLOBALS['ins_db']) ;
 
 
$tableau_projet = projet::getTousLesProjets($GLOBALS['ins_db']) ;
// On boucle sur chaque projet et on desinscrit l'utilisateur
foreach ($tableau_projet as $projet) {
// si le projet possède une liste associée
if ($projet->avoirListe()) {
$est_abonne = '0' ;
// on vérifie si l'utilisateur y est abonné
$projet->getListesAssociees() ;
 
try {
$xml_abonne = new SimpleXMLElement(file_get_contents(URL_LISTE_ACTU.'est_abonne.php?domaine=tela-botanica.org&liste='.$projet->_listes_associes[0]->getNom().'&mail='.$ancien_mail)) ;
$est_abonne = $xml_abonne[0] ;
// si c'est le cas
if($est_abonne == '1') {
// on supprime l'ancien mail et on rajoute le nouveau
$suppression_abonne = file_get_contents(URL_LISTE_ACTU.'suppression_abonne.php?domaine=tela-botanica.org&liste='.$projet->_listes_associes[0]->getNom().'&mail='.$ancien_mail) ;
$suppression_abonne = file_get_contents(URL_LISTE_ACTU.'ajout_abonne.php?domaine=tela-botanica.org&liste='.$projet->_listes_associes[0]->getNom().'&mail='.$nouveau_mail) ;
}
}
catch(Exception $e) {
trigger_error($e->getMessage()) ;
}
}
}
 
 
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.modification.inc.php,v 1.1 2008-10-27 16:56:08 aperonnet Exp $
/**
* Inscription
*
* Le fichier de modification de projet, appele par l'inscription
* en cas de modification d'un utilisateur
*
*@package projet
//Auteur original :
*@author Aurelien Peronnet <aurelien@tela-botanica.org>
*@copyright Tela-Botanica 2000-2006
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// On recupere id_utilisateur, l'identifiant de la personne qui se desinscrit
// On se trouve dans la fonction afficherContenuCorps de inscription.php
 
 
 
include_once 'client/projet/configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
$participant = new participe($GLOBALS['ins_db']) ;
 
 
$tableau_projet = projet::getTousLesProjets($GLOBALS['ins_db']) ;
// On boucle sur chaque projet et on desinscrit l'utilisateur
foreach ($tableau_projet as $projet) {
// si le projet possède une liste associée
if ($projet->avoirListe()) {
$est_abonne = '0' ;
// on vérifie si l'utilisateur y est abonné
$projet->getListesAssociees() ;
 
try {
$xml_abonne = new SimpleXMLElement(file_get_contents(URL_LISTE_ACTU.'est_abonne.php?domaine=tela-botanica.org&liste='.$projet->_listes_associes[0]->getNom().'&mail='.$ancien_mail)) ;
$est_abonne = $xml_abonne[0] ;
// si c'est le cas
if($est_abonne == '1') {
// on supprime l'ancien mail et on rajoute le nouveau
$suppression_abonne = file_get_contents(URL_LISTE_ACTU.'suppression_abonne.php?domaine=tela-botanica.org&liste='.$projet->_listes_associes[0]->getNom().'&mail='.$ancien_mail) ;
$suppression_abonne = file_get_contents(URL_LISTE_ACTU.'ajout_abonne.php?domaine=tela-botanica.org&liste='.$projet->_listes_associes[0]->getNom().'&mail='.$nouveau_mail) ;
}
}
catch(Exception $e) {
trigger_error($e->getMessage()) ;
}
}
}
 
 
?>
/trunk/configuration/projet.config.defaut.inc.php
File deleted
\ No newline at end of file
/trunk/configuration/projet.config.inc.php
New file
0,0 → 1,197
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.config.inc.php,v 1.13 2008-11-19 09:28:46 aperonnet Exp $
/**
* Application projet, fichier de configuration
*
* Fichier de configuration
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.13 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/**
//==================================== LES URLS ==================================
* Constantes liées à l'utilisation des url
//==================================================================================
*/
 
// Définition du lien vers "voir le projet"
define ("PROJET_LIEN_VOIR", "") ;
 
 
 
/**
//==================================== LES CHEMINS =================================
* Constantes définissant les chemins d'accé au différents fichiers inclus dans les
* applications.
//==================================================================================
*/
define ('PROJET_CHEMIN_APPLI','client/projet/');//le chemin vers l'application courante
define ('PROJET_CHEMIN_API_ARBRE', 'api/arbre/') ;
 
/** Chemin vers la bibliothèque API.*/
define ('PROJET_CHEMIN_BIBLIOTHEQUE_API', GEN_CHEMIN_API);
define ('PROJET_CHEMIN_ICONES', PROJET_CHEMIN_APPLI."icones/") ;
define ('PROJET_CHEMIN_CLASSES', PROJET_CHEMIN_APPLI.'classes/');//le chemin vers les fichiers propre à GSITE
define ('PROJET_CHEMIN_FONCTIONS', PROJET_CHEMIN_APPLI.'fonctions/') ;
define ('PROJET_CHEMIN_LIBRAIRIE','bibliotheque/');//le chemin de la librairie de fichier php
define ('PROJET_CHEMIN_FICHIER', "client/projet/fichiers/") ; // Chemin ou seront créer les dossiers
 
// Chemin vers les classes pour lire les listes de discussion
define ('PROJET_CHEMIN_CLASSES_LISTES', PROJET_CHEMIN_CLASSES."ezmlm-php-2.0/") ;
 
// Langue pas defaut
define ('PROJET_LANGUE_DEFAUT', "fr") ;
 
// Gestion de l'authentification
$GLOBALS['projet_auth'] = $GLOBALS['_GEN_commun']['pear_auth'];
 
// Un objet PEAR:DB connecté
$GLOBALS['projet_db'] = $GLOBALS['_GEN_commun']['pear_db'];
 
$GLOBALS['url'] = &$GLOBALS['_GEN_commun']['url'] ;
 
// La langue
if (!isset ($GLOBALS['lang'])) $GLOBALS['lang'] = PROJET_LANGUE_DEFAUT ;
/**
//==================================== CONSTANTES ==================================
* Constantes des noms de tables et de champs dans l'annuaire
//==================================================================================
*/
 
define ("PROJET_ANNUAIRE", "gen_annuaire") ; // Nom de la table d'annuaire
define ("PROJET_CHAMPS_NOM", "ga_nom") ; // Nom du champs nom
define ("PROJET_CHAMPS_MAIL", "ga_mail") ; // Nom du champs mail
define ("PROJET_CHAMPS_PRENOM", "ga_prenom") ; // Nom du champs prénom
define ("PROJET_CHAMPS_ID", "ga_id_administrateur") ;
 
// Lien vers l inscription du cms
define ('PROJET_LIEN_INSCRIPTION_CMS', '');
define ('PROJET_LIEN_ANNUAIRE','http://www.tela-botanica.org/page:inscription?m=annuaire_fiche_utilisateur_consultation&id_annuaire=1&id_utilisateur=');
 
/**
//==================================== CONSTANTES ==================================
* Constantes des chemins associés aux wikinis
//==================================================================================
*/
 
define ("PROJET_CHEMIN_WIKINI", "wikini/") ;
define ("PROJET_HOTE_WIKINI", "localhost") ;
define ("PROJET_UTILISATEUR_WIKINI", "") ;
define ("PROJET_MDP_WIKINI", "") ;
define ("PROJET_DB_WIKINI", "") ;
define ("PROJET_URL_WIKINI", "") ; // L'url vers le wikini
 
/**
//==================================== CONSTANTES ==================================
* Constantes des emails des administrateurs
//==================================================================================
*/
define ("PROJET_MAIL_ADMINISTRATEUR", "") ;
 
 
define ("PROJET_VARIABLE_ID_PROJET", "id_projet") ;
define ("PROJET_VARIABLE_ACTION", "act") ;
define ("PROJET_VARIABLE_ID_REPERTOIRE", "id_repertoire") ;
define ("PROJET_VARIABLE_ID_DOCUMENT", "id_document") ;
define ('PROJET_VARIABLE_SERVICE', 'service');
 
 
 
/**
//==================================== CONSTANTES ==================================
* Constantes pour les listes de discussion
//==================================================================================
*/
 
define ('PROJET_CHEMIN_LISTES', '') ;
define ('PROJET_DOMAINE_LISTE', 'localhost') ;
define ('PROJET_CHEMIN_ATELIERS', 'http://domaine.ext/papyrus.php?site=<>&menu=<>&id_projet=<>') ;
define ('PROJET_SERVEUR_VPOPMAIL', 'http://vpopmail.domaine.ext') ;
 
 
/**
//==================================== CONSTANTES ==================================
* Constantes pour des options
//==================================================================================
*/
define ('PROJET_UTILISE_TYPE', false) ;
define ('PROJET_UTILISE_HIERARCHIE', false) ;
define ('PROJET_LISTE_RESUME',true);
 
// Mettre à true si les utilisateurs peuvent déposer des projets
define ('PROJET_UTILISATEURS_COORD', false) ;
// Taille maximume des fichiers pouvant être uploadé : modifier aussi dans php.ini les variables :post_max_size et upload_max_filesize
define ('PROJET_UPLOAD_MAX_FILE_SIZE', 4*1024*1024) ;// 4 Mo
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.12 2008-10-29 15:49:24 aperonnet
* fichier de configuration de l'appli projet
*
* Revision 1.11 2008-05-21 14:37:48 alexandre_tb
* ajout de la constante PROJET_LIEN_INSCRIPTION_CMS
*
* Revision 1.10 2007-04-19 09:19:52 alexandre_tb
* constante PROJET_VARIABLE_SERVICE pour les liaisons asynchrone
*
* Revision 1.9 2007/02/13 15:11:39 jp_milcent
* Ajout d'une constante pour l'upload de fichier.
*
* Revision 1.8 2006/07/04 09:30:56 alexandre_tb
* Ajout d'une variable global lang pour éviter les warning dans certains cas
*
* Revision 1.7 2006/06/26 11:48:50 alexandre_tb
* typographie
*
* Revision 1.6 2006/03/02 09:24:36 mathilde
* remplacement des noms de tables de l'annuaire
*
* Revision 1.5 2006/02/15 16:33:42 alexandre_tb
* ajout de la constante PROJET_UTILISATEUR_COORD
*
* Revision 1.4 2006/01/26 14:06:07 florian
* ajout des constantes d'accès à vpopmail.
*
* Revision 1.3 2005/11/14 10:14:30 ddelon
* Projets Wikini
*
* Revision 1.2 2005/10/20 10:28:25 ddelon
* Wikini complet dans l'intégrateur Wikini
*
* Revision 1.1 2005/09/27 12:50:28 ddelon
* Projet configuration
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/trunk/documentation/projet.sql
File deleted
\ No newline at end of file
/trunk/documentation/installation.txt
1,23 → 1,23
Installation du module projet.
 
1. Uploader tous les fichiers de client/projet vers le serveur distant
2. Editer configuration/projet.config.inc.php, mettre des valeurs ad�quates
2. Editer configuration/projet.config.inc.php, mettre des valeurs adéquates
3. Effectuer les requetes du fichier documentation/installation_projet.sql
4. Ajouter un administrateur dans la table projet_statut_utilisateurs avec comme
statut 0
5. D�ployer l'application dans un menu de papyrus, mettre en argument presentation=arbre
afin de pouvoir cr�er un premier projet
5. Déployer l'application dans un menu de papyrus, mettre en argument presentation=arbre
afin de pouvoir créer un premier projet
6. S'identifier avec le compte administrateur
7. Aller sur l'appli projet et cr�er le premier projet
8. �ventuellement enlever le param�tre presentation
7. Aller sur l'appli projet et créer le premier projet
8. éventuellement enlever le paramètre presentation
 
## Les param�tres
presentation=(arbre,liste) Note lorsqu'on choisit liste, les menus apparaissent par d�faut
c'est une liste qui apparait mais sans les menus (cad seulement un point d'acc�s aux projets
## Les paramètres
presentation=(arbre,liste) Note lorsqu'on choisit liste, les menus apparaissent par défaut
c'est une liste qui apparait mais sans les menus (cad seulement un point d'accès aux projets
exclure=(un nombre) n'affichera pas le projet dont le num�ro est indiqu�,
sert � cr�er des projets qui n'apparaissent pas mais sont accessible via une url
on peut indiquer plusieur num�ro en les s�parant par des virgules
exclure=(un nombre) n'affichera pas le projet dont le numéro est indiqué,
sert à créer des projets qui n'apparaissent pas mais sont accessible via une url
on peut indiquer plusieur numéro en les séparant par des virgules
projet_type=(un_type) permet de filtrer les projets selon leur type
seulement_forum=(nombre) n'affiche que le projet nombre et uniquement la page forum
utilise lorsqu'on veut un simple forum
24,16 → 24,16
seulement=(identifiant projet) n'affichera qu'un seul projet
prive=(0/1) si nombre = 1 alors les utilisateurs ne peuvent pas s'inscrire seul,
il faut l'intervention du coordonateur ou plus.
telechargement=1 Affiche un porte-document juste pour t�l�charger les fichier, � utiliser conjointement
telechargement=1 Affiche un porte-document juste pour télécharger les fichier, à utiliser conjointement
avec "seulement"
## NOTE
dans la pr�sentation par arbre, il faut veiller � avoir une cime, cad un projet qui n'a pas de p�re
dans la présentation par arbre, il faut veiller à avoir une cime, cad un projet qui n'a pas de père
 
 
Installation des forums
 
dans php.ini, verifier que le safe_mode est � On
cr�er dans /usr/local/lib/safe_mode des liens symbolique vers les ex�cutables
dans php.ini, verifier que le safe_mode est à On
créer dans /usr/local/lib/safe_mode des liens symbolique vers les exécutables
de ezmlm
----
lrwxrwxrwx 1 root staff 30 Jul 9 16:09 ezmlm-idx -> /usr/local/bin/ezmlm/ezmlm-idx
42,9 → 42,9
lrwxrwxrwx 1 root staff 30 Jul 9 16:10 ezmlm-sub -> /usr/local/bin/ezmlm/ezmlm-sub
lrwxrwxrwx 1 root staff 32 Jul 9 16:10 ezmlm-unsub -> /usr/local/bin/ezmlm/ezmlm-unsub
 
�galement :
également :
lrwxrwxrwx 1 root staff 7 Jul 9 16:35 rm -> /bin/rm
 
 
Puis �crire une entr�e dans le fichier /etc/hosts du serveur pointant vers lui-m�me,
ce doit �tre la m�me que la constante PROJET_SERVEUR_VPOPMAIL
Puis écrire une entrée dans le fichier /etc/hosts du serveur pointant vers lui-même,
ce doit être la même que la constante PROJET_SERVEUR_VPOPMAIL
/trunk/presentation/liste.php
1,261 → 1,258
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste.php,v 1.8 2007-06-25 12:15:07 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de pr�sentation de la liste des projets
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
$titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php' ;
// On verifie si l'utilisateur participe a des projets
//echo PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php';
// Entete de la liste, qu'on recupere dans un template
 
if (PROJET_UTILISE_TYPE && $this->_type != "") {
include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php' ;
include_once 'HTML/Template/IT.php';
$template = new projetTemplate ($this->_db) ;
$chaine = $template->getTemplate(2, $GLOBALS['lang'], $this->_type);
if (projetTemplate::isError ($chaine)) return $chaine->getMessage() ;
$tpl = new HTML_Template_IT() ;
$tpl -> setTemplate($chaine);
}
 
if ($auth){
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$utilisateur_liste = new inscription_liste($this->_db) ;
// On teste ici s'il y a une mise a jour de statut
if (isset($_POST['statut'])) {
// $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$projet = new projet ($this->_db, $_GET['identifiant_projet']) ;
$projet->getListesAssociees() ;
$utilisateur_liste->modifierTypeInscription($projet->_listes_associes[0],$annuaire, $_POST['statut']) ;
}
if (count($participant->getIdProjetsStatuts($id_u))) {
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetListe = new HTML_listeProjet(true) ;
$entete_liste = array($auth ? PROJET_VOUS_PARTICIPEZ : PROJET_LISTE) ;
if ($auth) array_push ($entete_liste, PROJET_SE_DESINSCRIRE, PROJET_LISTE_DE_DISCUSSION) ;
 
 
$tableau_resultat = array () ;
 
$HTML_projetListe->construitEntete ($entete_liste) ;
 
// On construit $tableau_resultat avec une ligne par projet contenant un tableau (titre, statut_nom, id_statut, id_projet)
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
$statut_liste = new statut_liste($this->_db) ;
$tableau_statut = $statut_liste->getTousLesStatuts() ;
 
$statut = '' ;
$i = 0 ;
$HTML_projetListe->setModeModification() ;
$HTML_projetListe->setURL($this->_url) ;
foreach ($projetListe as $projet) {
if (participe::getStatutSurProjetCourant($id_u, $projet->getId(), $this->_db) == 4) continue ;
if ($auth) {
if ($projet->avoirListe()) {
$projet->getListesAssociees() ;
$statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $this->_auth) ;
//if ($statut == '') $statut = 0 ;
}
}
 
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_tableau = array ($projet->getId(), $projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'
) ;
if ($auth) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
if ($projet->avoirListe()) {
array_push ($ligne_tableau, $statut) ;
} else {
array_push($ligne_tableau, '') ;
}
array_push ($tableau_resultat, $ligne_tableau) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
$statut = '' ;
}
$HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
 
 
if ($HTML_projetListe->getRowCount() > 1) {
$res .= '<p>'.PROJET_PARTICIPER.'</p>';
$res .= $HTML_projetListe->toHTML() ;
}
} else {
$res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
}
}
 
// Un texte pour ceux qui ne sont pas identifi�s
if (!$auth) {
$res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
}
 
// Maintenant la liste des projets ou l'utilisateur ne participe pas.
// Et si pas loggue tous les projets
if ($auth) {
$projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
// Si certain projet sont � exclure, on les exclu
$projet_a_exclure = array() ;
if (count($this->_projet_exclu)) {
arsort($this->_projet_exclu) ;
foreach ($this->_projet_exclu as $valeur) {
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
if ($projetNonParticipantListe[$i]->getId() == $valeur) array_push ($projet_a_exclure, $i);}
}
}
if (PROJET_UTILISE_TYPE && $this->_type != '') {
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
if ($projetNonParticipantListe[$i]->getType() != $this->_type) array_push ($projet_a_exclure, $i) ;
}
}
 
foreach ($projet_a_exclure as $valeur) {
unset ($projetNonParticipantListe[$valeur]) ;
}
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php';
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array (PROJET_LISTE) ;
array_push ($entete_liste, PROJET_S_INSCRIRE) ;
 
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
 
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array ($projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) $res .= $HTML_projetNonParticipantListe->toHTML() ;
} else {
$projetNonParticipantListe = & $projetListe ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array (PROJET_LISTE) ;
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array ( $projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>', // le nom du projet
) ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
$res .= $HTML_projetNonParticipantListe->toHTML() ;
}
}
// Nettoyage de l'url
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$tpl->setVariable('liste_projet', $res) ;
$res = $tpl->get();
}
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
return $titre.$res ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: liste.php,v $
* Revision 1.8 2007-06-25 12:15:07 alexandre_tb
* merge from narmer
*
* Revision 1.7 2007-06-01 13:56:13 alexandre_tb
* ajout d un include manquant
*
* Revision 1.6 2007/04/19 15:34:35 neiluj
* préparration release (livraison) "Narmer" - v0.25
*
* Revision 1.5 2006/12/19 09:48:50 alexandre_tb
* am�lioration du retour erreur lors de l appel au template
*
* Revision 1.4 2006/12/18 17:24:09 alexandre_tb
* inclusion du fichier de langue en utilisant la globale 'lang'
*
* Revision 1.3 2006/09/18 09:56:28 alexandre_tb
* utilisation d'un template pour l'ent�te de la liste des projets
*
* Revision 1.2 2005/11/28 16:25:23 alexandre_tb
* nettoyage URL en sortie de programme
*
* Revision 1.1 2005/11/25 14:47:51 alexandre_tb
* version initiale
*
 
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste.php,v 1.8 2007-06-25 12:15:07 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de présentation de la liste des projets
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
$titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php' ;
// On verifie si l'utilisateur participe a des projets
//echo PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php';
// Entete de la liste, qu'on recupere dans un template
 
if (PROJET_UTILISE_TYPE && $this->_type != "") {
include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php' ;
include_once 'HTML/Template/IT.php';
$template = new projetTemplate ($this->_db) ;
$chaine = $template->getTemplate(2, $GLOBALS['lang'], $this->_type);
if (projetTemplate::isError ($chaine)) return $chaine->getMessage() ;
$tpl = new HTML_Template_IT() ;
$tpl -> setTemplate($chaine);
}
 
if ($auth){
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$utilisateur_liste = new inscription_liste($this->_db) ;
// On teste ici s'il y a une mise a jour de statut
if (isset($_POST['statut'])) {
// $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$projet = new projet ($this->_db, $_GET['identifiant_projet']) ;
$projet->getListesAssociees() ;
$utilisateur_liste->modifierTypeInscription($projet->_listes_associes[0],$annuaire, $_POST['statut']) ;
}
if (count($participant->getIdProjetsStatuts($id_u))) {
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetListe = new HTML_listeProjet(true) ;
$entete_liste = array($auth ? PROJET_VOUS_PARTICIPEZ : PROJET_LISTE) ;
if ($auth) array_push ($entete_liste, PROJET_SE_DESINSCRIRE, PROJET_LISTE_DE_DISCUSSION) ;
 
 
$tableau_resultat = array () ;
 
$HTML_projetListe->construitEntete ($entete_liste) ;
 
// On construit $tableau_resultat avec une ligne par projet contenant un tableau (titre, statut_nom, id_statut, id_projet)
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
$statut_liste = new statut_liste($this->_db) ;
$tableau_statut = $statut_liste->getTousLesStatuts() ;
 
$statut = '' ;
$i = 0 ;
$HTML_projetListe->setModeModification() ;
$HTML_projetListe->setURL($this->_url) ;
foreach ($projetListe as $projet) {
if (participe::getStatutSurProjetCourant($id_u, $projet->getId(), $this->_db) == 4) continue ;
if ($auth) {
if ($projet->avoirListe()) {
$projet->getListesAssociees() ;
$statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $this->_auth) ;
//if ($statut == '') $statut = 0 ;
}
}
 
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_tableau = array ($projet->getId(), $projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'
) ;
if ($auth) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
if ($projet->avoirListe()) {
array_push ($ligne_tableau, $statut) ;
} else {
array_push($ligne_tableau, '') ;
}
array_push ($tableau_resultat, $ligne_tableau) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
$statut = '' ;
}
$HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
 
 
if ($HTML_projetListe->getRowCount() > 1) {
$res .= '<p>'.PROJET_PARTICIPER.'</p>';
$res .= $HTML_projetListe->toHTML() ;
}
} else {
$res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
}
}
 
// Un texte pour ceux qui ne sont pas identifiés
if (!$auth) {
$res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
}
 
// Maintenant la liste des projets ou l'utilisateur ne participe pas.
// Et si pas loggue tous les projets
if ($auth) {
$projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
// Si certain projet sont à exclure, on les exclu
$projet_a_exclure = array() ;
if (count($this->_projet_exclu)) {
arsort($this->_projet_exclu) ;
foreach ($this->_projet_exclu as $valeur) {
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
if ($projetNonParticipantListe[$i]->getId() == $valeur) array_push ($projet_a_exclure, $i);}
}
}
if (PROJET_UTILISE_TYPE && $this->_type != '') {
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
if ($projetNonParticipantListe[$i]->getType() != $this->_type) array_push ($projet_a_exclure, $i) ;
}
}
 
foreach ($projet_a_exclure as $valeur) {
unset ($projetNonParticipantListe[$valeur]) ;
}
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php';
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array (PROJET_LISTE) ;
array_push ($entete_liste, PROJET_S_INSCRIRE) ;
 
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
 
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array ($projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) $res .= $HTML_projetNonParticipantListe->toHTML() ;
} else {
$projetNonParticipantListe = & $projetListe ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array (PROJET_LISTE) ;
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array ( $projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>', // le nom du projet
) ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
$res .= $HTML_projetNonParticipantListe->toHTML() ;
}
}
// Nettoyage de l'url
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$tpl->setVariable('liste_projet', $res) ;
$res = $tpl->get();
}
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
return $titre.$res ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.7 2007-06-01 13:56:13 alexandre_tb
* ajout d un include manquant
*
* Revision 1.6 2007/04/19 15:34:35 neiluj
* préparration release (livraison) "Narmer" - v0.25
*
* Revision 1.5 2006/12/19 09:48:50 alexandre_tb
* amélioration du retour erreur lors de l appel au template
*
* Revision 1.4 2006/12/18 17:24:09 alexandre_tb
* inclusion du fichier de langue en utilisant la globale 'lang'
*
* Revision 1.3 2006/09/18 09:56:28 alexandre_tb
* utilisation d'un template pour l'entête de la liste des projets
*
* Revision 1.2 2005/11/28 16:25:23 alexandre_tb
* nettoyage URL en sortie de programme
*
* Revision 1.1 2005/11/25 14:47:51 alexandre_tb
* version initiale
*
 
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/trunk/presentation/tela_ergo.php
1,494 → 1,486
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: tela_ergo.php,v 1.2 2008-09-01 14:37:15 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
define ('PROJET_VARIABLE_MODE_AFFICHAGE', 'projet_affichage');
define ('PROJET_VARIABLE_TRI', 'projet_tri');
define ('PROJET_VARIABLE_ORDRE_TRI', 'projet_ordre_tri');
define ('PROJET_VARIABLE_THEME', 'theme');
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
//$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
 
$_SESSION['_PROJET_']['motif_recherche'] = '';
 
$url = $this->_url->getURL();
$loggue = $this->_auth->getAuth();
 
// Verification sur l ordre de tri et mise en place
// du tri par defaut sur le titre
 
$valeur_acceptable_tri = array ('p_titre', 'ps_pourcent', 'ps_nombre_inscrit', 'ps_doc_derniere_semaine', 'psu_id_statut'); // Securite
 
if (isset($_GET[PROJET_VARIABLE_TRI]) && $_GET[PROJET_VARIABLE_TRI] != '' && in_array($_GET[PROJET_VARIABLE_TRI], $valeur_acceptable_tri)) {
$tri = $_GET[PROJET_VARIABLE_TRI];
} else {
$tri = 'p_titre';
}
 
$valeur_acceptable_ordre_tri = array ('asc', 'desc'); // securite
 
if (isset($_GET[PROJET_VARIABLE_ORDRE_TRI]) && $_GET[PROJET_VARIABLE_ORDRE_TRI] != ''
&& in_array ($_GET[PROJET_VARIABLE_ORDRE_TRI], $valeur_acceptable_ordre_tri)) {
$ordre_tri = $_GET[PROJET_VARIABLE_ORDRE_TRI];
} else {
$ordre_tri = '';
}
 
// variable de session pour se rappeler des choix du visiteur
if (!isset ($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && isset($_SESSION['_PROJET_']['projet_affichage']) && ($_SESSION['_PROJET_']['projet_affichage'] == 'simple' || $_SESSION['_PROJET_']['projet_affichage'] == 'expert')) {
$_GET[PROJET_VARIABLE_MODE_AFFICHAGE] = $_SESSION['_PROJET_']['projet_affichage'];
}
 
if (isset($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] != '') {
$_SESSION['_PROJET_']['projet_affichage'] = $_GET[PROJET_VARIABLE_MODE_AFFICHAGE];
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'simple');
$lien_interface_simple = '[<a href="'.$this->_url->getURL().'">Affichage simple</a>]';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_expert = '';
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert') {
$ordre_tri = 'desc';
$tri = 'ps_pourcent';
}
/** Affichage des themes de projets */
$requete_type = 'SELECT count( p_id ) AS nbe, pt_label_theme,pt_id_theme
FROM projet, projet_avoir_theme, projet_theme
WHERE p_id = pat_id_projet
AND pat_id_theme = pt_id_theme and p_en_dormance=0
GROUP BY pt_id_theme';
 
$resultat_type = $GLOBALS['projet_db']->query($requete_type);
 
if (DB::isError($resultat_type)) return $resultat_type->getMessage();
 
$tableau_theme = array();
 
$requete_nb_pj = 'select count(*) as nb from projet';
$nombre_total_projet = $GLOBALS['projet_db']->getOne($requete_nb_pj);
 
// On ajoute le theme tous
$tableau_theme[0]['label'] = 'Tous les projets';
$tableau_theme[0]['id'] = 0;
$tableau_theme[0]['nombre_projet'] = $nombre_total_projet;
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
$tableau_theme[0]['lien'] = $this->_url->getURL();
 
// Et le theme en dormance
$requete_dormance = 'select count(p_id) as nb_p_dorman from projet where p_en_dormance=1';
$nb_p_dormant = $GLOBALS['projet_db']->getOne($requete_dormance);
 
 
 
while ($ligne_type = $resultat_type->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_theme[$ligne_type->pt_id_theme]['label'] = $ligne_type->pt_label_theme;
$tableau_theme[$ligne_type->pt_id_theme]['id'] = $ligne_type->pt_id_theme;
$tableau_theme[$ligne_type->pt_id_theme]['nombre_projet'] = $ligne_type->nbe;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, $ligne_type->pt_id_theme);
$tableau_theme[$ligne_type->pt_id_theme]['lien'] = $this->_url->getURL();
}
$tableau_theme[9]['label'] = 'En dormance';
$tableau_theme[9]['id'] = 9;
$tableau_theme[9]['nombre_projet'] = $nb_p_dormant;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, 9);
$tableau_theme[9]['lien'] = $this->_url->getURL();
 
 
$this->_url->removeQueryString(PROJET_VARIABLE_THEME);
 
// Contruction de la requete, soit avec le moteur de recherche
// soit la liste des projets
if (isset($_GET['projet_recherche']) && $_GET['projet_recherche'] != '') {
$_SESSION['_PROJET_']['motif_recherche'] = $_GET['projet_recherche'];
if (!isset($GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'])) $GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'] = $this->_db;
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php';
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_projet.class.php';
$moteur = new More_Recherche($_SESSION['_PROJET_']['motif_recherche']);
$recherche_projet = new More_Recherche_Projet($_SESSION['_PROJET_']['motif_recherche']);
$moteur->ajouterRecherche($recherche_projet);
$resultats = $moteur->rechercherMotif();
// $chaine_id_projet contient une liste d identifiant separer par une virgule
if (!empty($resultats)) {
$chaine_id_projet = '';
foreach ($resultats as $projet) {
$chaine_id_projet .= $projet['id'].',';
}
$chaine_id_projet = substr($chaine_id_projet, 0, -1);
$where_recherche = ' where p_id in ('.$chaine_id_projet.')';
$valeur_projet_recherche = $_GET['projet_recherche'];
}
} else {
$where_recherche = '';
$valeur_projet_recherche = '';
}
$select = '';
$from_recherche = '';
if (isset($_GET[PROJET_VARIABLE_THEME])) {
$from_recherche = ' left join projet_avoir_theme on pat_id_projet=p_id left join projet_theme on pat_id_theme=pt_id_theme';
$where_recherche = ' where pat_id_theme='.intval($_GET[PROJET_VARIABLE_THEME]);
$theme_selectionne = $_GET[PROJET_VARIABLE_THEME];
} else {
$theme_selectionne = 0;
}
 
if ($this->_auth->getAuth()) {
/** on recherche egalement le statut si l utilisateur est loggue */
$from_recherche .= ' left join projet_statut_utilisateurs on psu_id_projet=p_id and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID)).
' left join projet_statut on psu_id_statut=ps_id_statut';
$select = 'psu_id_statut, ps_statut_nom,';
}
 
if ($ordre_tri == '') $ordre_tri = 'desc';
$requete = 'select '.$select.'p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'.
' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '.
' ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'.
' projet left join projet_lien_liste on p_id=pl_id_projet'.
' left join projet_lien_liste_externe on p_id=plle_id_projet'.
' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'.
$from_recherche.
$where_recherche.
' group by p_id order by '.$tri.' '.$ordre_tri ;
 
$resultat = $this->_db->query($requete) ;
 
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
$nombre_resultat = $resultat->numRows();
 
/* Si l utilisateur est loggue, on recherche son statut par rapport aux projets */
if ($this->_auth->getAuth()) {
$requete_statut = 'select psu_id_projet, psu_id_statut, ps_statut_nom from projet_statut_utilisateurs, projet_statut'.
' where ps_id_statut=psu_id_statut and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID));
$resultat_statut = $GLOBALS['projet_db']->query($requete_statut);
while ($ligne_statut = $resultat_statut->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_statut[$ligne_statut->psu_id_projet]['id_statut'] = $ligne_statut->psu_id_statut;
$tableau_statut[$ligne_statut->psu_id_projet]['nom_statut'] = $ligne_statut->ps_statut_nom;
}
}
 
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/Pager/Pager.php';
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
// Si le projet est en dormance, on ne l affiche pas dans le mode normal
// Sauf si le theme choisit est "en dormance"
/*if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert' && $ligne->p_en_dormance == 1 && $theme_selectionne != 9) {
} else {*/
$donnees[] = $ligne;
//}
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') $perpage = $nombre_resultat; else $perpage = 20;
// Parametre du pager
$params = array (
'mode' => 'Sliding',
'perPage' => $perpage,
'delta' => '5',
'linkClass' => 'num_page',
'curPageLinkClassName' => 'page_courante',
'spacesBeforeSeparator' => 0,
'spacesAfterSeparator' => 0,
'separator' => '',
'prevImg' => '&lt;&lt; Page pr&eacute;c&eacute;dente',
'nextImg' => 'Page suivante &gt;&gt;',
'extraVars' => array ('projet_recherche' => $_SESSION['_PROJET_']['motif_recherche'],
PROJET_VARIABLE_MODE_AFFICHAGE => $_SESSION['_PROJET_']['projet_affichage']),
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$links = $pager->getLinks();
$data = $pager->getPageData();
$nombre_projets = $pager->numItems();
$range = $pager->getOffsetByPageId();
 
 
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
// On verifie si l'utilisateur participe a des projets
 
$projetNonParticipantListe = & $projetListe ;
 
 
$liste_projet = array() ;
// La liste
 
 
$tableau_donnees = array();
foreach ($data as $ligne) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $ligne->p_id) ;
 
$tableau_donnees[$ligne->p_id]['lien'] = $this->_url->getURL();
$tableau_donnees[$ligne->p_id]['titre'] = $ligne->p_titre;
 
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_inscrit;
 
$tableau_donnees[$ligne->p_id]['resume'] = $ligne->p_resume;
if ($_SESSION['_PROJET_']['projet_affichage'] == 'simple') {
if ($ligne->ps_pourcent <33) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Peu actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_faible';
}
else if ($ligne->ps_pourcent < 66) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Assez actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_moyenne';
}
else if ($ligne->ps_pourcent <= 100) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Tr&egrave;s actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_elevee';
}
} else {
$tableau_donnees[$ligne->p_id]['activite'] = $ligne->ps_pourcent.'%';
}
$res .= $ligne->p_resume ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$res .= '(<a href="'.$this->_url->getURL().'">Rejoindre ce projet</a>)'."\n";
// Recherche du forum
if ($ligne->pl_id_liste != null && $ligne->plle_id_liste == null) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
 
$forum = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /></a>'."\n";
$res .= $forum;
} else {
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
if ($ligne->plle_id_liste != null) {
$info_liste = $listes_ext->getInfoListe($ligne->plle_id_liste) ;
$forum = '<a href="'.$info_liste->AGO_A_URLGRP.
'"><img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/></a>';
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_membre_yahoo;
} else {
$forum = '-';
}
}
if ($ligne->ps_msg_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['nombre_message'] = $ligne->ps_msg_derniere_semaine;
} else {
$tableau_donnees[$ligne->p_id]['nombre_message'] = 0;
}
$tableau_donnees[$ligne->p_id]['forum'] = $forum;
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$wiki_res = '<a href="'.$link.'">voir</a>' ;
if ($ligne->ps_modifwiki_derniere_semaine != 0) {
$wiki_res .= ' <span title="Nouvelles contributions cette semaine"> ( +'.$ligne->ps_modifwiki_derniere_semaine.' )</span>';
}
$this->_url->removeQueryString ('act');
} else {
$wiki_res = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini'] = $wiki_res;
$titre= '<a href="'.$this->_url->getURL().'">'.$ligne->p_titre.'</a>';
if ($ligne->p_avoir_document != 0) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_DOCUMENT) ;
$document = '<a href="'.$this->_url->getURL().'">voir</a>' ;
if ($ligne->ps_doc_derniere_semaine != 0) {
$document .= ' <span title="Nouveaux documents cette semaine">( + '.$ligne->ps_doc_derniere_semaine.')</span>';
}
} else {
$document = '-' ;
}
$tableau_donnees[$ligne->p_id]['document'] = $document;
/*if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$this->_url->addQueryString('wiki', 'DerniersChangementsRSS/xml');
$wiki_rss = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
$this->_url->removeQueryString ('act');
$this->_url->removeQueryString ('wiki');
} else {
$wiki_rss = '-' ;
}*/
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$url_rss = PROJET_URL_WIKINI.$ligne->p_wikini.'/wakka.php?wiki=DerniersChangementsRss/xml';
//$this->_url->addQueryString('wiki', 'DerniersChangementsRSS/xml');
$wiki_rss = '<a href="'.$url_rss.'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
//$this->_url->removeQueryString ('act');
//$this->_url->removeQueryString ('wiki');
} else {
$wiki_rss = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini_rss'] = $wiki_rss;
$this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
$participant = '<a href="'.$this->_url->getURL().'">voir</a>' ;
$tableau_donnees[$ligne->p_id]['lien_participants'] = $this->_url->getURL();
if ($ligne->ps_nombre_inscrit_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '<span title="Nouveaux inscrits cette semaine">( + '.$ligne->ps_nombre_inscrit_derniere_semaine.' )</span>';
} else {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '';
}
$ligne_projet = array ( '', $titre, $forum, // le nom du projet
$wiki_res, $wiki_rss,$document, $participant) ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
if ($loggue) {
switch ($ligne->psu_id_statut) {
case 1 : $icone_statut = 'etoile_rouge';
$tableau_donnees[$ligne->p_id]['id_statut'] = 3;
break;
case 2 : $icone_statut = 'etoile_verte';
$tableau_donnees[$ligne->p_id]['id_statut'] = 2;
break;
case 3 : $icone_statut = 'etoile_grise';
$tableau_donnees[$ligne->p_id]['id_statut'] = 1;
break;
default : $tableau_donnees[$ligne->p_id]['statut_icone'] = '';
$tableau_donnees[$ligne->p_id]['id_statut'] = 0;
$icone_statut = false;
}
if ($icone_statut) $tableau_donnees[$ligne->p_id]['statut_icone'] = '<img src="'.PROJET_CHEMIN_ICONES.$icone_statut.'.png" alt="'.$ligne->ps_statut_nom.'" title="'.$ligne->ps_statut_nom.'" />';
}
$res .= '</li>'."\n";
}
$res .= '</ul>'."\n";
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
 
// Correction bug tri par participant
if ($_GET[PROJET_VARIABLE_TRI] == 'ps_nombre_inscrit') {
foreach ($tableau_donnees as $key => $row) {
$nombre_inscrit[$key] = $row['nombre_participants'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') $flag = SORT_ASC ; else $flag = SORT_DESC ;
array_multisort($nombre_inscrit, $flag, $tableau_donnees);
}
 
// Correction bug tri sur les statuts
if ($_GET[PROJET_VARIABLE_TRI] == 'psu_id_statut') {
foreach ($tableau_donnees as $key => $row) {
$id_statut[$key] = $row['id_statut'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') $flag = SORT_ASC ; else $flag = SORT_DESC ;
array_multisort($id_statut, $flag, $tableau_donnees);
}
 
$pair = true;
 
ob_start();
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'legende\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
include_once PROJET_CHEMIN_CLASSES.'enteteColonneTriable.class.php';
foreach ($valeur_acceptable_tri as $var_tri) {
$enteteTri[$var_tri] = new enteteColonneTriable($var_tri);
$enteteTri[$var_tri]->setColonneCliquee($tri, PROJET_VARIABLE_TRI);
$enteteTri[$var_tri]->setOrdre($ordre_tri, PROJET_VARIABLE_ORDRE_TRI);
}
 
$lien_tri_titre = $enteteTri['p_titre']->getLien($this->_url);
$lien_tri_activite = $enteteTri['ps_pourcent']->getLien($this->_url);
$lien_tri_participants = $enteteTri['ps_nombre_inscrit']->getLien($this->_url);
$lien_tri_doc = $enteteTri['ps_doc_derniere_semaine']->getLien($this->_url);
$lien_tri_statut = $enteteTri['psu_id_statut']->getLien($this->_url);
include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet_expert.tpl.html';
} else {
include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet.tpl.html';
}
$res = ob_get_contents();
ob_end_clean();
 
 
// Nettoyage de l'url
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
$this->_url->removeQueryString (PROJET_VARIABLE_MODE_AFFICHAGE);
$this->_url->removeQueryString (PROJET_VARIABLE_ORDRE_TRI);
$this->_url->removeQueryString (PROJET_VARIABLE_TRI);
return $res ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: tela_ergo.php,v $
* Revision 1.2 2008-09-01 14:37:15 alexandre_tb
* modification du tri par defaut
*
* Revision 1.1 2008-08-25 15:00:28 alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: tela_ergo.php,v 1.4 2008-10-27 16:54:59 aperonnet Exp $
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
define ('PROJET_VARIABLE_MODE_AFFICHAGE', 'projet_affichage');
define ('PROJET_VARIABLE_TRI', 'projet_tri');
define ('PROJET_VARIABLE_ORDRE_TRI', 'projet_ordre_tri');
define ('PROJET_VARIABLE_THEME', 'theme');
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
//$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
 
$_SESSION['_PROJET_']['motif_recherche'] = '';
 
$url = $this->_url->getURL();
$loggue = $this->_auth->getAuth();
 
// Verification sur l ordre de tri et mise en place
// du tri par defaut sur le titre
 
$valeur_acceptable_tri = array ('p_titre', 'ps_pourcent', 'ps_nombre_inscrit', 'ps_doc_derniere_semaine', 'psu_id_statut'); // Securite
 
if (isset($_GET[PROJET_VARIABLE_TRI]) && $_GET[PROJET_VARIABLE_TRI] != '' && in_array($_GET[PROJET_VARIABLE_TRI], $valeur_acceptable_tri)) {
$tri = $_GET[PROJET_VARIABLE_TRI];
 
} else {
$tri = 'p_titre';
}
 
$valeur_acceptable_ordre_tri = array ('asc', 'desc'); // securite
 
if (isset($_GET[PROJET_VARIABLE_ORDRE_TRI]) && $_GET[PROJET_VARIABLE_ORDRE_TRI] != ''
&& in_array ($_GET[PROJET_VARIABLE_ORDRE_TRI], $valeur_acceptable_ordre_tri)) {
$ordre_tri = $_GET[PROJET_VARIABLE_ORDRE_TRI];
 
} else {
$ordre_tri = '';
}
 
// variable de session pour se rappeler des choix du visiteur
if (!isset ($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && isset($_SESSION['_PROJET_']['projet_affichage']) && ($_SESSION['_PROJET_']['projet_affichage'] == 'simple' || $_SESSION['_PROJET_']['projet_affichage'] == 'expert')) {
$_GET[PROJET_VARIABLE_MODE_AFFICHAGE] = $_SESSION['_PROJET_']['projet_affichage'];
}
 
if (isset($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] != '') {
$_SESSION['_PROJET_']['projet_affichage'] = $_GET[PROJET_VARIABLE_MODE_AFFICHAGE];
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'simple');
$lien_interface_simple = '[<a href="'.$this->_url->getURL().'">Affichage simple</a>]';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_expert = '';
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert') {
$ordre_tri = 'desc';
$tri = 'ps_pourcent';
}
/** Affichage des themes de projets */
$requete_type = 'SELECT count( p_id ) AS nbe, pt_label_theme,pt_id_theme
FROM projet, projet_avoir_theme, projet_theme
WHERE p_id = pat_id_projet
AND pat_id_theme = pt_id_theme and p_en_dormance=0
GROUP BY pt_id_theme';
 
$resultat_type = $GLOBALS['projet_db']->query($requete_type);
 
if (DB::isError($resultat_type)) return $resultat_type->getMessage();
 
$tableau_theme = array();
 
$requete_nb_pj = 'select count(*) as nb from projet';
$nombre_total_projet = $GLOBALS['projet_db']->getOne($requete_nb_pj);
 
// On ajoute le theme tous
$tableau_theme[0]['label'] = 'Tous les projets';
$tableau_theme[0]['id'] = 0;
$tableau_theme[0]['nombre_projet'] = $nombre_total_projet;
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
$tableau_theme[0]['lien'] = $this->_url->getURL();
 
// Et le theme en dormance
$requete_dormance = 'select count(p_id) as nb_p_dorman from projet where p_en_dormance=1';
$nb_p_dormant = $GLOBALS['projet_db']->getOne($requete_dormance);
 
 
 
while ($ligne_type = $resultat_type->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_theme[$ligne_type->pt_id_theme]['label'] = $ligne_type->pt_label_theme;
$tableau_theme[$ligne_type->pt_id_theme]['id'] = $ligne_type->pt_id_theme;
$tableau_theme[$ligne_type->pt_id_theme]['nombre_projet'] = $ligne_type->nbe;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, $ligne_type->pt_id_theme);
$tableau_theme[$ligne_type->pt_id_theme]['lien'] = $this->_url->getURL();
}
$tableau_theme[9]['label'] = 'En dormance';
$tableau_theme[9]['id'] = 9;
$tableau_theme[9]['nombre_projet'] = $nb_p_dormant;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, 9);
$tableau_theme[9]['lien'] = $this->_url->getURL();
 
 
$this->_url->removeQueryString(PROJET_VARIABLE_THEME);
 
// Contruction de la requete, soit avec le moteur de recherche
// soit la liste des projets
if (isset($_GET['projet_recherche']) && $_GET['projet_recherche'] != '') {
$_SESSION['_PROJET_']['motif_recherche'] = $_GET['projet_recherche'];
if (!isset($GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'])) $GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'] = $this->_db;
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php';
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_projet.class.php';
 
$moteur = new More_Recherche($_SESSION['_PROJET_']['motif_recherche']);
$recherche_projet = new More_Recherche_Projet($_SESSION['_PROJET_']['motif_recherche']);
$moteur->ajouterRecherche($recherche_projet);
$resultats = $moteur->rechercherMotif();
 
// $chaine_id_projet contient une liste d identifiant separer par une virgule
if (!empty($resultats)) {
$chaine_id_projet = '';
foreach ($resultats as $projet) {
$chaine_id_projet .= $projet['id'].',';
}
$chaine_id_projet = substr($chaine_id_projet, 0, -1);
$where_recherche = ' where p_id in ('.$chaine_id_projet.')';
 
$valeur_projet_recherche = $_GET['projet_recherche'];
}
} else {
$where_recherche = '';
$valeur_projet_recherche = '';
}
$select = '';
$from_recherche = '';
if (isset($_GET[PROJET_VARIABLE_THEME])) {
$from_recherche = ' left join projet_avoir_theme on pat_id_projet=p_id left join projet_theme on pat_id_theme=pt_id_theme';
$where_recherche = ' where pat_id_theme='.$this->_db->escapeSimple(intval($_GET[PROJET_VARIABLE_THEME]));
$theme_selectionne = $_GET[PROJET_VARIABLE_THEME];
} else {
$theme_selectionne = 0;
}
 
if ($this->_auth->getAuth()) {
/** on recherche egalement le statut si l utilisateur est loggue */
 
$from_recherche .= ' left join projet_statut_utilisateurs on psu_id_projet=p_id and psu_id_utilisateur='.
$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID)).
' left join projet_statut on psu_id_statut=ps_id_statut';
$select = 'psu_id_statut, ps_statut_nom,';
}
$requete = 'select '.$select.'p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'.
' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '.
' ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'.
' projet left join projet_lien_liste on p_id=pl_id_projet'.
' left join projet_lien_liste_externe on p_id=plle_id_projet'.
' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'.
$from_recherche.
$where_recherche.
' group by p_id order by '.$tri.' '.$ordre_tri ;
 
if ($ordre_tri == '') $ordre_tri = 'desc';
 
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
$nombre_resultat = $resultat->numRows();
 
/* Si l utilisateur est loggue, on recherche son statut par rapport aux projets */
if ($this->_auth->getAuth()) {
$requete_statut = 'select psu_id_projet, psu_id_statut, ps_statut_nom from projet_statut_utilisateurs, projet_statut'.
' where ps_id_statut=psu_id_statut and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID));
$resultat_statut = $GLOBALS['projet_db']->query($requete_statut);
while ($ligne_statut = $resultat_statut->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_statut[$ligne_statut->psu_id_projet]['id_statut'] = $ligne_statut->psu_id_statut;
$tableau_statut[$ligne_statut->psu_id_projet]['nom_statut'] = $ligne_statut->ps_statut_nom;
}
}
 
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/Pager/Pager.php';
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
 
// Si le projet est en dormance, on ne l affiche pas dans le mode normal
// Sauf si le theme choisit est "en dormance"
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert' && $ligne->p_en_dormance == 1 && $theme_selectionne != 9) {
 
} else {
$donnees[] = $ligne;
}
 
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') $perpage = $nombre_resultat; else $perpage = 20;
// Parametre du pager
$params = array (
'mode' => 'Sliding',
'perPage' => $perpage,
'delta' => '5',
'linkClass' => 'num_page',
'curPageLinkClassName' => 'page_courante',
'spacesBeforeSeparator' => 0,
'spacesAfterSeparator' => 0,
'separator' => '',
'prevImg' => '&lt;&lt; Page pr&eacute;c&eacute;dente',
'nextImg' => 'Page suivante &gt;&gt;',
'extraVars' => array ('projet_recherche' => $_SESSION['_PROJET_']['motif_recherche'],
PROJET_VARIABLE_MODE_AFFICHAGE => $_SESSION['_PROJET_']['projet_affichage']),
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$links = $pager->getLinks();
$data = $pager->getPageData();
$nombre_projets = $pager->numItems();
$range = $pager->getOffsetByPageId();
 
 
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
// On verifie si l'utilisateur participe a des projets
 
$projetNonParticipantListe = & $projetListe ;
 
 
$liste_projet = array() ;
// La liste
 
 
$tableau_donnees = array();
foreach ($data as $ligne) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $ligne->p_id) ;
 
$tableau_donnees[$ligne->p_id]['lien'] = $this->_url->getURL();
$tableau_donnees[$ligne->p_id]['titre'] = $ligne->p_titre;
 
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_inscrit;
 
$tableau_donnees[$ligne->p_id]['resume'] = $ligne->p_resume;
if ($_SESSION['_PROJET_']['projet_affichage'] == 'simple') {
if ($ligne->ps_pourcent <33) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Peu actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_faible';
}
else if ($ligne->ps_pourcent < 66) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Assez actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_moyenne';
}
else if ($ligne->ps_pourcent <= 100) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Tr&egrave;s actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_elevee';
}
} else {
$tableau_donnees[$ligne->p_id]['activite'] = $ligne->ps_pourcent.'%';
}
$res .= $ligne->p_resume ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$res .= '(<a href="'.$this->_url->getURL().'">Rejoindre ce projet</a>)'."\n";
 
// Recherche du forum
if ($ligne->pl_id_liste != null && $ligne->plle_id_liste == null) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
 
$forum = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /></a>'."\n";
$res .= $forum;
 
} else {
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
if ($ligne->plle_id_liste != null) {
$info_liste = $listes_ext->getInfoListe($ligne->plle_id_liste) ;
 
$forum = '<a href="'.$info_liste->AGO_A_URLGRP.
'"><img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/></a>';
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_membre_yahoo;
} else {
$forum = '-';
}
}
if ($ligne->ps_msg_derniere_semaine != 0) {
 
$tableau_donnees[$ligne->p_id]['nombre_message'] = $ligne->ps_msg_derniere_semaine;
} else {
$tableau_donnees[$ligne->p_id]['nombre_message'] = 0;
}
$tableau_donnees[$ligne->p_id]['forum'] = $forum;
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$wiki_res = '<a href="'.$link.'">voir</a>' ;
if ($ligne->ps_modifwiki_derniere_semaine != 0) {
$wiki_res .= ' <span title="Nouvelles contributions cette semaine"> ( +'.$ligne->ps_modifwiki_derniere_semaine.' )</span>';
}
$this->_url->removeQueryString ('act');
} else {
$wiki_res = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini'] = $wiki_res;
$titre= '<a href="'.$this->_url->getURL().'">'.$ligne->p_titre.'</a>';
 
if ($ligne->p_avoir_document != 0) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_DOCUMENT) ;
$document = '<a href="'.$this->_url->getURL().'">voir</a>' ;
if ($ligne->ps_doc_derniere_semaine != 0) {
$document .= ' <span title="Nouveaux documents cette semaine">( + '.$ligne->ps_doc_derniere_semaine.')</span>';
}
} else {
$document = '-' ;
}
$tableau_donnees[$ligne->p_id]['document'] = $document;
 
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$url_rss = PROJET_URL_WIKINI.$ligne->p_wikini.'/wakka.php?wiki=DerniersChangementsRss/xml';
//$this->_url->addQueryString('wiki', 'DerniersChangementsRSS/xml');
$wiki_rss = '<a href="'.$url_rss.'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
//$this->_url->removeQueryString ('act');
//$this->_url->removeQueryString ('wiki');
} else {
$wiki_rss = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini_rss'] = $wiki_rss;
 
$this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
$participant = '<a href="'.$this->_url->getURL().'">voir</a>' ;
$tableau_donnees[$ligne->p_id]['lien_participants'] = $this->_url->getURL();
if ($ligne->ps_nombre_inscrit_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '<span title="Nouveaux inscrits cette semaine">( + '.$ligne->ps_nombre_inscrit_derniere_semaine.' )</span>';
} else {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '';
}
 
$ligne_projet = array ( '', $titre, $forum, // le nom du projet
$wiki_res, $wiki_rss,$document, $participant) ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
 
if ($loggue) {
switch ($ligne->psu_id_statut) {
case 1 : $icone_statut = 'etoile_rouge';
$tableau_donnees[$ligne->p_id]['id_statut'] = 3;
break;
case 2 : $icone_statut = 'etoile_verte';
$tableau_donnees[$ligne->p_id]['id_statut'] = 2;
break;
case 3 : $icone_statut = 'etoile_grise';
$tableau_donnees[$ligne->p_id]['id_statut'] = 1;
break;
default : $tableau_donnees[$ligne->p_id]['statut_icone'] = '';
$tableau_donnees[$ligne->p_id]['id_statut'] = 0;
$icone_statut = false;
}
if ($icone_statut) $tableau_donnees[$ligne->p_id]['statut_icone'] = '<img src="'.PROJET_CHEMIN_ICONES.$icone_statut.'.png" alt="'.$ligne->ps_statut_nom.'" title="'.$ligne->ps_statut_nom.'" />';
 
}
$res .= '</li>'."\n";
}
$res .= '</ul>'."\n";
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
 
// Correction bug tri par participant
if ($_GET[PROJET_VARIABLE_TRI] == 'ps_nombre_inscrit') {
foreach ($tableau_donnees as $key => $row) {
$nombre_inscrit[$key] = $row['nombre_participants'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') $flag = SORT_ASC ; else $flag = SORT_DESC ;
array_multisort($nombre_inscrit, $flag, $tableau_donnees);
}
 
// Correction bug tri sur les statuts
if ($_GET[PROJET_VARIABLE_TRI] == 'psu_id_statut') {
foreach ($tableau_donnees as $key => $row) {
$id_statut[$key] = $row['id_statut'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') $flag = SORT_ASC ; else $flag = SORT_DESC ;
array_multisort($id_statut, $flag, $tableau_donnees);
}
 
$pair = true;
 
ob_start();
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'legende\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
include_once PROJET_CHEMIN_CLASSES.'enteteColonneTriable.class.php';
foreach ($valeur_acceptable_tri as $var_tri) {
$enteteTri[$var_tri] = new enteteColonneTriable($var_tri);
$enteteTri[$var_tri]->setColonneCliquee($tri, PROJET_VARIABLE_TRI);
$enteteTri[$var_tri]->setOrdre($ordre_tri, PROJET_VARIABLE_ORDRE_TRI);
 
}
 
$lien_tri_titre = $enteteTri['p_titre']->getLien($this->_url);
$lien_tri_activite = $enteteTri['ps_pourcent']->getLien($this->_url);
$lien_tri_participants = $enteteTri['ps_nombre_inscrit']->getLien($this->_url);
$lien_tri_doc = $enteteTri['ps_doc_derniere_semaine']->getLien($this->_url);
$lien_tri_statut = $enteteTri['psu_id_statut']->getLien($this->_url);
include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet_expert.tpl.html';
} else {
include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet.tpl.html';
}
$res = ob_get_contents();
ob_end_clean();
 
 
// Nettoyage de l'url
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
$this->_url->removeQueryString (PROJET_VARIABLE_MODE_AFFICHAGE);
$this->_url->removeQueryString (PROJET_VARIABLE_ORDRE_TRI);
$this->_url->removeQueryString (PROJET_VARIABLE_TRI);
return $res ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2008-09-16 14:07:40 alexandre_tb
* suppression du bug intermittent sur le moteur de recherche
*
* Revision 1.2 2008-09-01 14:37:15 alexandre_tb
* modification du tri par defaut
*
* Revision 1.1 2008-08-25 15:00:28 alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/presentation/tela.php
23,7 → 23,7
/**
* Application projet
*
* Fichier de pr�sentation de la liste des projets pour Tela Botanica
* Fichier de présentation de la liste des projets pour Tela Botanica
*
*@package projet
//Auteur original :
71,7 → 71,7
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
// On v�rifie si l'utilisateur participe � des projets
// On vérifie si l'utilisateur participe à des projets
 
$projetNonParticipantListe = & $projetListe ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
153,13 → 153,13
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2007-04-19 15:34:35 neiluj
* pr�parration release (livraison) "Narmer" - v0.25
* préparration release (livraison) "Narmer" - v0.25
*
* Revision 1.5.2.1 2007/04/11 14:24:39 alexandre_tb
* am�lioration des performances par l'appel d'une requete directe
* amélioration des performances par l'appel d'une requete directe
*
* Revision 1.5 2006/10/30 11:26:11 jp_milcent
* Modification du cartouche concernant la cr�ation d'un projet sur Tela.
* Modification du cartouche concernant la création d'un projet sur Tela.
*
* Revision 1.4 2006/01/09 21:55:19 ddelon
* flux rss dans liste des projets
/trunk/presentation/mes_projets.php
1,505 → 1,505
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: mes_projets.php,v 1.1 2008-09-01 14:36:48 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
define ('PROJET_VARIABLE_MODE_AFFICHAGE', 'projet_affichage');
define ('PROJET_VARIABLE_TRI', 'projet_tri');
define ('PROJET_VARIABLE_ORDRE_TRI', 'projet_ordre_tri');
define ('PROJET_VARIABLE_THEME', 'theme');
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
//$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
 
$_SESSION['_PROJET_']['motif_recherche'] = '';
 
$url = $this->_url->getURL();
$loggue = $this->_auth->getAuth();
 
// Verification sur l ordre de tri et mise en place
// du tri par defaut sur le titre
 
$valeur_acceptable_tri = array ('p_titre', 'ps_pourcent', 'ps_nombre_inscrit', 'ps_doc_derniere_semaine', 'psu_id_statut'); // Securite
 
if (isset($_GET[PROJET_VARIABLE_TRI]) && $_GET[PROJET_VARIABLE_TRI] != '' && in_array($_GET[PROJET_VARIABLE_TRI], $valeur_acceptable_tri)) {
$tri = $_GET[PROJET_VARIABLE_TRI];
 
} else {
$tri = 'p_titre';
}
 
$valeur_acceptable_ordre_tri = array ('asc', 'desc'); // securite
 
if (isset($_GET[PROJET_VARIABLE_ORDRE_TRI]) && $_GET[PROJET_VARIABLE_ORDRE_TRI] != ''
&& in_array ($_GET[PROJET_VARIABLE_ORDRE_TRI], $valeur_acceptable_ordre_tri)) {
$ordre_tri = $_GET[PROJET_VARIABLE_ORDRE_TRI];
 
} else {
$ordre_tri = '';
}
 
// variable de session pour se rappeler des choix du visiteur
if (!isset ($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && isset($_SESSION['_PROJET_']['projet_affichage']) && ($_SESSION['_PROJET_']['projet_affichage'] == 'simple' || $_SESSION['_PROJET_']['projet_affichage'] == 'expert')) {
$_GET[PROJET_VARIABLE_MODE_AFFICHAGE] = $_SESSION['_PROJET_']['projet_affichage'];
}
 
if (isset($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] != '') {
$_SESSION['_PROJET_']['projet_affichage'] = $_GET[PROJET_VARIABLE_MODE_AFFICHAGE];
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'simple');
$lien_interface_simple = '[<a href="'.$this->_url->getURL().'">Affichage simple</a>]';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_expert = '';
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert') {
$ordre_tri = 'desc';
$tri = 'ps_pourcent';
}
/** Affichage des themes de projets */
$requete_type = 'SELECT count( p_id ) AS nbe, pt_label_theme,pt_id_theme
FROM projet, projet_avoir_theme, projet_theme
WHERE p_id = pat_id_projet
AND pat_id_theme = pt_id_theme and p_en_dormance=0
GROUP BY pt_id_theme';
 
$resultat_type = $GLOBALS['projet_db']->query($requete_type);
 
if (DB::isError($resultat_type)) return $resultat_type->getMessage();
 
$tableau_theme = array();
 
$requete_nb_pj = 'select count(*) as nb from projet';
$nombre_total_projet = $GLOBALS['projet_db']->getOne($requete_nb_pj);
 
// On ajoute le theme tous
$tableau_theme[0]['label'] = 'Tous les projets';
$tableau_theme[0]['id'] = 0;
$tableau_theme[0]['nombre_projet'] = $nombre_total_projet;
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
$tableau_theme[0]['lien'] = $this->_url->getURL();
 
// Et le theme en dormance
$requete_dormance = 'select count(p_id) as nb_p_dorman from projet where p_en_dormance=1';
$nb_p_dormant = $GLOBALS['projet_db']->getOne($requete_dormance);
 
 
 
while ($ligne_type = $resultat_type->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_theme[$ligne_type->pt_id_theme]['label'] = $ligne_type->pt_label_theme;
$tableau_theme[$ligne_type->pt_id_theme]['id'] = $ligne_type->pt_id_theme;
$tableau_theme[$ligne_type->pt_id_theme]['nombre_projet'] = $ligne_type->nbe;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, $ligne_type->pt_id_theme);
$tableau_theme[$ligne_type->pt_id_theme]['lien'] = $this->_url->getURL();
}
$tableau_theme[9]['label'] = 'En dormance';
$tableau_theme[9]['id'] = 9;
$tableau_theme[9]['nombre_projet'] = $nb_p_dormant;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, 9);
$tableau_theme[9]['lien'] = $this->_url->getURL();
 
 
$this->_url->removeQueryString(PROJET_VARIABLE_THEME);
 
// Contruction de la requete, soit avec le moteur de recherche
// soit la liste des projets
if (isset($_GET['projet_recherche']) && $_GET['projet_recherche'] != '') {
$_SESSION['_PROJET_']['motif_recherche'] = $_GET['projet_recherche'];
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php';
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_projet.class.php';
 
$moteur = new More_Recherche($_SESSION['_PROJET_']['motif_recherche']);
$recherche_projet = new More_Recherche_Projet($_SESSION['_PROJET_']['motif_recherche']);
$moteur->ajouterRecherche($recherche_projet);
$resultats = $moteur->rechercherMotif();
 
// $chaine_id_projet contient une liste d identifiant separer par une virgule
if (!empty($resultats)) {
$chaine_id_projet = '';
foreach ($resultats as $projet) {
$chaine_id_projet .= $projet['id'].',';
}
$chaine_id_projet = substr($chaine_id_projet, 0, -1);
$where_recherche = ' where p_id in ('.$chaine_id_projet.')';
 
$valeur_projet_recherche = $_GET['projet_recherche'];
}
} else {
$where_recherche = '';
$valeur_projet_recherche = '';
}
$select = '';
$from_recherche = '';
if (isset($_GET[PROJET_VARIABLE_THEME])) {
$from_recherche = ' left join projet_avoir_theme on pat_id_projet=p_id left join projet_theme on pat_id_theme=pt_id_theme';
$where_recherche = ' where pat_id_theme='.$this->_db->escapeSimple($_GET[PROJET_VARIABLE_THEME]);
$theme_selectionne = $_GET[PROJET_VARIABLE_THEME];
} else {
$theme_selectionne = 0;
}
 
if ($this->_auth->getAuth()) {
/** on recherche egalement le statut si l utilisateur est loggue */
// On recherche les projets auquels l utilisateur participe
include_once PROJET_CHEMIN_CLASSES.'participe.class.php';
$participant = new participe ($this->_db);
$tableau_projet = $participant->getInformationsUtilisateurs($this->_auth->getAuthData(PROJET_CHAMPS_ID));
$chaine_id_projet = '';
if (count ($tableau_projet) == 0) {
return '<p class="information">Vous n\'&ecirc;tes inscrit &agrave; aucun projet</p>';
}
foreach ($tableau_projet as $projet) {
$chaine_id_projet .= $projet[3].',';
}
$chaine_id_projet = substr($chaine_id_projet, 0, -1);
$where_recherche .= ' where p_id in ('.$chaine_id_projet.')';
 
$from_recherche .= ' left join projet_statut_utilisateurs on psu_id_projet=p_id and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID)).
' left join projet_statut on psu_id_statut=ps_id_statut';
$select = 'psu_id_statut, ps_statut_nom,';
}
$requete = 'select '.$select.'p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'.
' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '.
' ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'.
' projet left join projet_lien_liste on p_id=pl_id_projet'.
' left join projet_lien_liste_externe on p_id=plle_id_projet'.
' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'.
$from_recherche.
$where_recherche.
' group by p_id order by '.$tri.' '.$ordre_tri ;
 
if ($ordre_tri == '') {
$ordre_tri = 'desc';
}
 
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
$nombre_resultat = $resultat->numRows();
 
/* Si l utilisateur est loggue, on recherche son statut par rapport aux projets */
if ($this->_auth->getAuth()) {
$requete_statut = 'select psu_id_projet, psu_id_statut, ps_statut_nom from projet_statut_utilisateurs, projet_statut'.
' where ps_id_statut=psu_id_statut and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID));
$resultat_statut = $GLOBALS['projet_db']->query($requete_statut);
while ($ligne_statut = $resultat_statut->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_statut[$ligne_statut->psu_id_projet]['id_statut'] = $ligne_statut->psu_id_statut;
$tableau_statut[$ligne_statut->psu_id_projet]['nom_statut'] = $ligne_statut->ps_statut_nom;
}
}
 
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/Pager/Pager.php';
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
// Si le projet est en dormance, on ne l affiche pas dans le mode normal
// Sauf si le theme choisit est "en dormance"
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert' && $ligne->p_en_dormance == 1 && $theme_selectionne != 9) {
 
} else {
$donnees[] = $ligne;
}
 
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
$perpage = $nombre_resultat;
} else {
$perpage = 20;
}
// Parametre du pager
$params = array (
'mode' => 'Sliding',
'perPage' => $perpage,
'delta' => '5',
'linkClass' => 'num_page',
'curPageLinkClassName' => 'page_courante',
'spacesBeforeSeparator' => 0,
'spacesAfterSeparator' => 0,
'separator' => '',
'prevImg' => '&lt;&lt; Page pr&eacute;c&eacute;dente',
'nextImg' => 'Page suivante &gt;&gt;',
'extraVars' => array ('projet_recherche' => $_SESSION['_PROJET_']['motif_recherche'],
PROJET_VARIABLE_MODE_AFFICHAGE => $_SESSION['_PROJET_']['projet_affichage']),
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$links = $pager->getLinks();
$data = $pager->getPageData();
$nombre_projets = $pager->numItems();
$range = $pager->getOffsetByPageId();
 
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
// On verifie si l'utilisateur participe a des projets
 
$projetNonParticipantListe = & $projetListe ;
 
 
$liste_projet = array() ;
// La liste
 
 
$tableau_donnees = array();
foreach ($data as $ligne) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $ligne->p_id) ;
 
$tableau_donnees[$ligne->p_id]['lien'] = $this->_url->getURL();
$tableau_donnees[$ligne->p_id]['titre'] = $ligne->p_titre;
 
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_inscrit;
 
$tableau_donnees[$ligne->p_id]['resume'] = $ligne->p_resume;
if ($_SESSION['_PROJET_']['projet_affichage'] == 'simple') {
if ($ligne->ps_pourcent < 33) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Peu actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_faible';
} else if ($ligne->ps_pourcent < 66) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Assez actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_moyenne';
} else if ($ligne->ps_pourcent <= 100) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Tr&egrave;s actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_elevee';
}
} else {
$tableau_donnees[$ligne->p_id]['activite'] = $ligne->ps_pourcent.'%';
}
$res .= $ligne->p_resume ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$res .= '(<a href="'.$this->_url->getURL().'">Rejoindre ce projet</a>)'."\n";
 
// Recherche du forum
if ($ligne->pl_id_liste != null && $ligne->plle_id_liste == null) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
 
$forum = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /></a>'."\n";
$res .= $forum;
 
} else {
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
if ($ligne->plle_id_liste != null) {
$info_liste = $listes_ext->getInfoListe($ligne->plle_id_liste) ;
 
$forum = '<a href="'.$info_liste->AGO_A_URLGRP.
'"><img src="sites/commun/generique/images/icones/yahoo.png" alt="Yahoo"/></a>';
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_membre_yahoo;
} else {
$forum = '-';
}
}
if ($ligne->ps_msg_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['nombre_message'] = $ligne->ps_msg_derniere_semaine;
} else {
$tableau_donnees[$ligne->p_id]['nombre_message'] = 0;
}
$tableau_donnees[$ligne->p_id]['forum'] = $forum;
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$wiki_res = '<a href="'.$link.'">voir</a>' ;
if ($ligne->ps_modifwiki_derniere_semaine != 0) {
$wiki_res .= ' <span title="Nouvelles contributions cette semaine"> ( +'.$ligne->ps_modifwiki_derniere_semaine.' )</span>';
}
$this->_url->removeQueryString ('act');
} else {
$wiki_res = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini'] = $wiki_res;
$titre = '<a href="'.$this->_url->getURL().'">'.$ligne->p_titre.'</a>';
 
if ($ligne->p_avoir_document != 0) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_DOCUMENT) ;
$document = '<a href="'.$this->_url->getURL().'">voir</a>' ;
if ($ligne->ps_doc_derniere_semaine != 0) {
$document .= ' <span title="Nouveaux documents cette semaine">( + '.$ligne->ps_doc_derniere_semaine.')</span>';
}
} else {
$document = '-' ;
}
$tableau_donnees[$ligne->p_id]['document'] = $document;
 
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$this->_url->addQueryString('wiki', 'DerniersChangementsRSS/xml');
$wiki_rss = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
$this->_url->removeQueryString ('act');
$this->_url->removeQueryString ('wiki');
} else {
$wiki_rss = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini_rss'] = $wiki_rss;
 
$this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
$participant = '<a href="'.$this->_url->getURL().'">voir</a>' ;
$tableau_donnees[$ligne->p_id]['lien_participants'] = $this->_url->getURL();
if ($ligne->ps_nombre_inscrit_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '<span title="Nouveaux inscrits cette semaine">( + '.$ligne->ps_nombre_inscrit_derniere_semaine.' )</span>';
} else {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '';
}
 
$ligne_projet = array ( '', $titre, $forum, // le nom du projet
$wiki_res, $wiki_rss,$document, $participant);
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
 
if ($loggue) {
switch ($ligne->psu_id_statut) {
case 1 : $icone_statut = 'etoile_rouge';
$tableau_donnees[$ligne->p_id]['id_statut'] = 3;
break;
case 2 : $icone_statut = 'etoile_verte';
$tableau_donnees[$ligne->p_id]['id_statut'] = 2;
break;
case 3 : $icone_statut = 'etoile_grise';
$tableau_donnees[$ligne->p_id]['id_statut'] = 1;
break;
default :
$tableau_donnees[$ligne->p_id]['statut_icone'] = '';
$tableau_donnees[$ligne->p_id]['id_statut'] = 0;
$icone_statut = false;
}
if ($icone_statut) {
$tableau_donnees[$ligne->p_id]['statut_icone'] = '<img src="'.PROJET_CHEMIN_ICONES.$icone_statut.'.png" alt="'.$ligne->ps_statut_nom.'" title="'.$ligne->ps_statut_nom.'" />';
}
 
}
$res .= '</li>'."\n";
}
$res .= '</ul>'."\n";
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
 
// Correction bug tri par participant
if ($_GET[PROJET_VARIABLE_TRI] == 'ps_nombre_inscrit') {
foreach ($tableau_donnees as $key => $row) {
$nombre_inscrit[$key] = $row['nombre_participants'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') {
$flag = SORT_ASC ;
} else {
$flag = SORT_DESC ;
}
array_multisort($nombre_inscrit, $flag, $tableau_donnees);
}
 
// Correction bug tri sur les statuts
if ($_GET[PROJET_VARIABLE_TRI] == 'psu_id_statut') {
foreach ($tableau_donnees as $key => $row) {
$id_statut[$key] = $row['id_statut'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') {
$flag = SORT_ASC ;
} else {
$flag = SORT_DESC ;
}
array_multisort($id_statut, $flag, $tableau_donnees);
}
 
$pair = true;
 
ob_start();
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'legende\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
include_once PROJET_CHEMIN_CLASSES.'enteteColonneTriable.class.php';
foreach ($valeur_acceptable_tri as $var_tri) {
$enteteTri[$var_tri] = new enteteColonneTriable($var_tri);
$enteteTri[$var_tri]->setColonneCliquee($tri, PROJET_VARIABLE_TRI);
$enteteTri[$var_tri]->setOrdre($ordre_tri, PROJET_VARIABLE_ORDRE_TRI);
}
 
$lien_tri_titre = $enteteTri['p_titre']->getLien($this->_url);
$lien_tri_activite = $enteteTri['ps_pourcent']->getLien($this->_url);
$lien_tri_participants = $enteteTri['ps_nombre_inscrit']->getLien($this->_url);
$lien_tri_doc = $enteteTri['ps_doc_derniere_semaine']->getLien($this->_url);
$lien_tri_statut = $enteteTri['psu_id_statut']->getLien($this->_url);
include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet_expert.tpl.html';
} else {
include_once PROJET_CHEMIN_APPLI.'/squelettes/mes_projets.tpl.html';
}
$res = ob_get_contents();
ob_end_clean();
 
 
// Nettoyage de l'url
$this->_url->removeQueryString(PROJET_VARIABLE_ID_PROJET);
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
$this->_url->removeQueryString(PROJET_VARIABLE_ORDRE_TRI);
$this->_url->removeQueryString(PROJET_VARIABLE_TRI);
return $res;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: mes_projets.php,v $
* Revision 1.1 2008-09-01 14:36:48 alexandre_tb
* version intiale
* sert a afficher les projets auquels on est inscrit
*
* Revision 1.1 2008-08-25 15:00:28 alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: mes_projets.php,v 1.1 2008-09-01 14:36:48 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
define ('PROJET_VARIABLE_MODE_AFFICHAGE', 'projet_affichage');
define ('PROJET_VARIABLE_TRI', 'projet_tri');
define ('PROJET_VARIABLE_ORDRE_TRI', 'projet_ordre_tri');
define ('PROJET_VARIABLE_THEME', 'theme');
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
//$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
 
$_SESSION['_PROJET_']['motif_recherche'] = '';
 
$url = $this->_url->getURL();
$loggue = $this->_auth->getAuth();
 
// Verification sur l ordre de tri et mise en place
// du tri par defaut sur le titre
 
$valeur_acceptable_tri = array ('p_titre', 'ps_pourcent', 'ps_nombre_inscrit', 'ps_doc_derniere_semaine', 'psu_id_statut'); // Securite
 
if (isset($_GET[PROJET_VARIABLE_TRI]) && $_GET[PROJET_VARIABLE_TRI] != '' && in_array($_GET[PROJET_VARIABLE_TRI], $valeur_acceptable_tri)) {
$tri = $_GET[PROJET_VARIABLE_TRI];
 
} else {
$tri = 'p_titre';
}
 
$valeur_acceptable_ordre_tri = array ('asc', 'desc'); // securite
 
if (isset($_GET[PROJET_VARIABLE_ORDRE_TRI]) && $_GET[PROJET_VARIABLE_ORDRE_TRI] != ''
&& in_array ($_GET[PROJET_VARIABLE_ORDRE_TRI], $valeur_acceptable_ordre_tri)) {
$ordre_tri = $_GET[PROJET_VARIABLE_ORDRE_TRI];
 
} else {
$ordre_tri = '';
}
 
// variable de session pour se rappeler des choix du visiteur
if (!isset ($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && isset($_SESSION['_PROJET_']['projet_affichage']) && ($_SESSION['_PROJET_']['projet_affichage'] == 'simple' || $_SESSION['_PROJET_']['projet_affichage'] == 'expert')) {
$_GET[PROJET_VARIABLE_MODE_AFFICHAGE] = $_SESSION['_PROJET_']['projet_affichage'];
}
 
if (isset($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] != '') {
$_SESSION['_PROJET_']['projet_affichage'] = $_GET[PROJET_VARIABLE_MODE_AFFICHAGE];
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'simple');
$lien_interface_simple = '[<a href="'.$this->_url->getURL().'">Affichage simple</a>]';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_expert = '';
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
} else {
$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
$lien_interface_simple = '';
$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert') {
$ordre_tri = 'desc';
$tri = 'ps_pourcent';
}
/** Affichage des themes de projets */
$requete_type = 'SELECT count( p_id ) AS nbe, pt_label_theme,pt_id_theme
FROM projet, projet_avoir_theme, projet_theme
WHERE p_id = pat_id_projet
AND pat_id_theme = pt_id_theme and p_en_dormance=0
GROUP BY pt_id_theme';
 
$resultat_type = $GLOBALS['projet_db']->query($requete_type);
 
if (DB::isError($resultat_type)) return $resultat_type->getMessage();
 
$tableau_theme = array();
 
$requete_nb_pj = 'select count(*) as nb from projet';
$nombre_total_projet = $GLOBALS['projet_db']->getOne($requete_nb_pj);
 
// On ajoute le theme tous
$tableau_theme[0]['label'] = 'Tous les projets';
$tableau_theme[0]['id'] = 0;
$tableau_theme[0]['nombre_projet'] = $nombre_total_projet;
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
$tableau_theme[0]['lien'] = $this->_url->getURL();
 
// Et le theme en dormance
$requete_dormance = 'select count(p_id) as nb_p_dorman from projet where p_en_dormance=1';
$nb_p_dormant = $GLOBALS['projet_db']->getOne($requete_dormance);
 
 
 
while ($ligne_type = $resultat_type->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_theme[$ligne_type->pt_id_theme]['label'] = $ligne_type->pt_label_theme;
$tableau_theme[$ligne_type->pt_id_theme]['id'] = $ligne_type->pt_id_theme;
$tableau_theme[$ligne_type->pt_id_theme]['nombre_projet'] = $ligne_type->nbe;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, $ligne_type->pt_id_theme);
$tableau_theme[$ligne_type->pt_id_theme]['lien'] = $this->_url->getURL();
}
$tableau_theme[9]['label'] = 'En dormance';
$tableau_theme[9]['id'] = 9;
$tableau_theme[9]['nombre_projet'] = $nb_p_dormant;
$this->_url->addQueryString(PROJET_VARIABLE_THEME, 9);
$tableau_theme[9]['lien'] = $this->_url->getURL();
 
 
$this->_url->removeQueryString(PROJET_VARIABLE_THEME);
 
// Contruction de la requete, soit avec le moteur de recherche
// soit la liste des projets
if (isset($_GET['projet_recherche']) && $_GET['projet_recherche'] != '') {
$_SESSION['_PROJET_']['motif_recherche'] = $_GET['projet_recherche'];
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php';
include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_projet.class.php';
 
$moteur = new More_Recherche($_SESSION['_PROJET_']['motif_recherche']);
$recherche_projet = new More_Recherche_Projet($_SESSION['_PROJET_']['motif_recherche']);
$moteur->ajouterRecherche($recherche_projet);
$resultats = $moteur->rechercherMotif();
 
// $chaine_id_projet contient une liste d identifiant separer par une virgule
if (!empty($resultats)) {
$chaine_id_projet = '';
foreach ($resultats as $projet) {
$chaine_id_projet .= $projet['id'].',';
}
$chaine_id_projet = substr($chaine_id_projet, 0, -1);
$where_recherche = ' where p_id in ('.$chaine_id_projet.')';
 
$valeur_projet_recherche = $_GET['projet_recherche'];
}
} else {
$where_recherche = '';
$valeur_projet_recherche = '';
}
$select = '';
$from_recherche = '';
if (isset($_GET[PROJET_VARIABLE_THEME])) {
$from_recherche = ' left join projet_avoir_theme on pat_id_projet=p_id left join projet_theme on pat_id_theme=pt_id_theme';
$where_recherche = ' where pat_id_theme='.$this->_db->escapeSimple($_GET[PROJET_VARIABLE_THEME]);
$theme_selectionne = $_GET[PROJET_VARIABLE_THEME];
} else {
$theme_selectionne = 0;
}
 
if ($this->_auth->getAuth()) {
/** on recherche egalement le statut si l utilisateur est loggue */
// On recherche les projets auquels l utilisateur participe
include_once PROJET_CHEMIN_CLASSES.'participe.class.php';
$participant = new participe ($this->_db);
$tableau_projet = $participant->getInformationsUtilisateurs($this->_auth->getAuthData(PROJET_CHAMPS_ID));
$chaine_id_projet = '';
if (count ($tableau_projet) == 0) {
return '<p class="information">Vous n\'&ecirc;tes inscrit &agrave; aucun projet</p>';
}
foreach ($tableau_projet as $projet) {
$chaine_id_projet .= $projet[3].',';
}
$chaine_id_projet = substr($chaine_id_projet, 0, -1);
$where_recherche .= ' where p_id in ('.$chaine_id_projet.')';
 
$from_recherche .= ' left join projet_statut_utilisateurs on psu_id_projet=p_id and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID)).
' left join projet_statut on psu_id_statut=ps_id_statut';
$select = 'psu_id_statut, ps_statut_nom,';
}
$requete = 'select '.$select.'p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'.
' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '.
' ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'.
' projet left join projet_lien_liste on p_id=pl_id_projet'.
' left join projet_lien_liste_externe on p_id=plle_id_projet'.
' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'.
$from_recherche.
$where_recherche.
' group by p_id order by '.$tri.' '.$ordre_tri ;
 
if ($ordre_tri == '') {
$ordre_tri = 'desc';
}
 
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
$nombre_resultat = $resultat->numRows();
 
/* Si l utilisateur est loggue, on recherche son statut par rapport aux projets */
if ($this->_auth->getAuth()) {
$requete_statut = 'select psu_id_projet, psu_id_statut, ps_statut_nom from projet_statut_utilisateurs, projet_statut'.
' where ps_id_statut=psu_id_statut and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID));
$resultat_statut = $GLOBALS['projet_db']->query($requete_statut);
while ($ligne_statut = $resultat_statut->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_statut[$ligne_statut->psu_id_projet]['id_statut'] = $ligne_statut->psu_id_statut;
$tableau_statut[$ligne_statut->psu_id_projet]['nom_statut'] = $ligne_statut->ps_statut_nom;
}
}
 
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/Pager/Pager.php';
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
// Si le projet est en dormance, on ne l affiche pas dans le mode normal
// Sauf si le theme choisit est "en dormance"
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert' && $ligne->p_en_dormance == 1 && $theme_selectionne != 9) {
 
} else {
$donnees[] = $ligne;
}
 
}
 
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
$perpage = $nombre_resultat;
} else {
$perpage = 20;
}
// Parametre du pager
$params = array (
'mode' => 'Sliding',
'perPage' => $perpage,
'delta' => '5',
'linkClass' => 'num_page',
'curPageLinkClassName' => 'page_courante',
'spacesBeforeSeparator' => 0,
'spacesAfterSeparator' => 0,
'separator' => '',
'prevImg' => '&lt;&lt; Page pr&eacute;c&eacute;dente',
'nextImg' => 'Page suivante &gt;&gt;',
'extraVars' => array ('projet_recherche' => $_SESSION['_PROJET_']['motif_recherche'],
PROJET_VARIABLE_MODE_AFFICHAGE => $_SESSION['_PROJET_']['projet_affichage']),
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$links = $pager->getLinks();
$data = $pager->getPageData();
$nombre_projets = $pager->numItems();
$range = $pager->getOffsetByPageId();
 
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
// On verifie si l'utilisateur participe a des projets
 
$projetNonParticipantListe = & $projetListe ;
 
 
$liste_projet = array() ;
// La liste
 
 
$tableau_donnees = array();
foreach ($data as $ligne) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $ligne->p_id) ;
 
$tableau_donnees[$ligne->p_id]['lien'] = $this->_url->getURL();
$tableau_donnees[$ligne->p_id]['titre'] = $ligne->p_titre;
 
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_inscrit;
 
$tableau_donnees[$ligne->p_id]['resume'] = $ligne->p_resume;
if ($_SESSION['_PROJET_']['projet_affichage'] == 'simple') {
if ($ligne->ps_pourcent < 33) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Peu actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_faible';
} else if ($ligne->ps_pourcent < 66) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Assez actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_moyenne';
} else if ($ligne->ps_pourcent <= 100) {
$tableau_donnees[$ligne->p_id]['activite'] = 'Tr&egrave;s actif';
$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_elevee';
}
} else {
$tableau_donnees[$ligne->p_id]['activite'] = $ligne->ps_pourcent.'%';
}
$res .= $ligne->p_resume ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
$res .= '(<a href="'.$this->_url->getURL().'">Rejoindre ce projet</a>)'."\n";
 
// Recherche du forum
if ($ligne->pl_id_liste != null && $ligne->plle_id_liste == null) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
 
$forum = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /></a>'."\n";
$res .= $forum;
 
} else {
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
if ($ligne->plle_id_liste != null) {
$info_liste = $listes_ext->getInfoListe($ligne->plle_id_liste) ;
 
$forum = '<a href="'.$info_liste->AGO_A_URLGRP.
'"><img src="sites/commun/generique/images/icones/yahoo.png" alt="Yahoo"/></a>';
$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_membre_yahoo;
} else {
$forum = '-';
}
}
if ($ligne->ps_msg_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['nombre_message'] = $ligne->ps_msg_derniere_semaine;
} else {
$tableau_donnees[$ligne->p_id]['nombre_message'] = 0;
}
$tableau_donnees[$ligne->p_id]['forum'] = $forum;
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$wiki_res = '<a href="'.$link.'">voir</a>' ;
if ($ligne->ps_modifwiki_derniere_semaine != 0) {
$wiki_res .= ' <span title="Nouvelles contributions cette semaine"> ( +'.$ligne->ps_modifwiki_derniere_semaine.' )</span>';
}
$this->_url->removeQueryString ('act');
} else {
$wiki_res = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini'] = $wiki_res;
$titre = '<a href="'.$this->_url->getURL().'">'.$ligne->p_titre.'</a>';
 
if ($ligne->p_avoir_document != 0) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_DOCUMENT) ;
$document = '<a href="'.$this->_url->getURL().'">voir</a>' ;
if ($ligne->ps_doc_derniere_semaine != 0) {
$document .= ' <span title="Nouveaux documents cette semaine">( + '.$ligne->ps_doc_derniere_semaine.')</span>';
}
} else {
$document = '-' ;
}
$tableau_donnees[$ligne->p_id]['document'] = $document;
 
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$this->_url->addQueryString('wiki', 'DerniersChangementsRSS/xml');
$wiki_rss = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
$this->_url->removeQueryString ('act');
$this->_url->removeQueryString ('wiki');
} else {
$wiki_rss = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini_rss'] = $wiki_rss;
 
$this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
$participant = '<a href="'.$this->_url->getURL().'">voir</a>' ;
$tableau_donnees[$ligne->p_id]['lien_participants'] = $this->_url->getURL();
if ($ligne->ps_nombre_inscrit_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '<span title="Nouveaux inscrits cette semaine">( + '.$ligne->ps_nombre_inscrit_derniere_semaine.' )</span>';
} else {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '';
}
 
$ligne_projet = array ( '', $titre, $forum, // le nom du projet
$wiki_res, $wiki_rss,$document, $participant);
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
 
if ($loggue) {
switch ($ligne->psu_id_statut) {
case 1 : $icone_statut = 'etoile_rouge';
$tableau_donnees[$ligne->p_id]['id_statut'] = 3;
break;
case 2 : $icone_statut = 'etoile_verte';
$tableau_donnees[$ligne->p_id]['id_statut'] = 2;
break;
case 3 : $icone_statut = 'etoile_grise';
$tableau_donnees[$ligne->p_id]['id_statut'] = 1;
break;
default :
$tableau_donnees[$ligne->p_id]['statut_icone'] = '';
$tableau_donnees[$ligne->p_id]['id_statut'] = 0;
$icone_statut = false;
}
if ($icone_statut) {
$tableau_donnees[$ligne->p_id]['statut_icone'] = '<img src="'.PROJET_CHEMIN_ICONES.$icone_statut.'.png" alt="'.$ligne->ps_statut_nom.'" title="'.$ligne->ps_statut_nom.'" />';
}
 
}
$res .= '</li>'."\n";
}
$res .= '</ul>'."\n";
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
 
// Correction bug tri par participant
if ($_GET[PROJET_VARIABLE_TRI] == 'ps_nombre_inscrit') {
foreach ($tableau_donnees as $key => $row) {
$nombre_inscrit[$key] = $row['nombre_participants'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') {
$flag = SORT_ASC ;
} else {
$flag = SORT_DESC ;
}
array_multisort($nombre_inscrit, $flag, $tableau_donnees);
}
 
// Correction bug tri sur les statuts
if ($_GET[PROJET_VARIABLE_TRI] == 'psu_id_statut') {
foreach ($tableau_donnees as $key => $row) {
$id_statut[$key] = $row['id_statut'];
}
if ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') {
$flag = SORT_ASC ;
} else {
$flag = SORT_DESC ;
}
array_multisort($id_statut, $flag, $tableau_donnees);
}
 
$pair = true;
 
ob_start();
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
GEN_stockerCodeScript('animatedcollapse.addDiv(\'legende\', \'fade=1, height="100px"\');' ."\n".
'animatedcollapse.init();' ."\n");
include_once PROJET_CHEMIN_CLASSES.'enteteColonneTriable.class.php';
foreach ($valeur_acceptable_tri as $var_tri) {
$enteteTri[$var_tri] = new enteteColonneTriable($var_tri);
$enteteTri[$var_tri]->setColonneCliquee($tri, PROJET_VARIABLE_TRI);
$enteteTri[$var_tri]->setOrdre($ordre_tri, PROJET_VARIABLE_ORDRE_TRI);
}
 
$lien_tri_titre = $enteteTri['p_titre']->getLien($this->_url);
$lien_tri_activite = $enteteTri['ps_pourcent']->getLien($this->_url);
$lien_tri_participants = $enteteTri['ps_nombre_inscrit']->getLien($this->_url);
$lien_tri_doc = $enteteTri['ps_doc_derniere_semaine']->getLien($this->_url);
$lien_tri_statut = $enteteTri['psu_id_statut']->getLien($this->_url);
include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet_expert.tpl.html';
} else {
include_once PROJET_CHEMIN_APPLI.'/squelettes/mes_projets.tpl.html';
}
$res = ob_get_contents();
ob_end_clean();
 
 
// Nettoyage de l'url
$this->_url->removeQueryString(PROJET_VARIABLE_ID_PROJET);
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
$this->_url->removeQueryString(PROJET_VARIABLE_ORDRE_TRI);
$this->_url->removeQueryString(PROJET_VARIABLE_TRI);
return $res;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: mes_projets.php,v $
* Revision 1.1 2008-09-01 14:36:48 alexandre_tb
* version intiale
* sert a afficher les projets auquels on est inscrit
*
* Revision 1.1 2008-08-25 15:00:28 alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/presentation/arbre.php
19,11 → 19,11
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id:$
// CVS : $Id: arbre.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* Fichier de pr�sentation de la liste des projets par arbre
* Fichier de présentation de la liste des projets par arbre
*
*@package projet
//Auteur original :
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision:$
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
39,17 → 39,17
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// ON est dans la m�thode mesProjets() de la classe projetControleur
// ON est dans la méthode mesProjets() de la classe projetControleur
 
$titre = '<h1>Arbre des Projets</h1>'."\n" ;
 
/*if (PROJET_UTILISE_TYPE && $this->_type != '') {
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}*/
}
include_once PROJET_CHEMIN_API_ARBRE.'arbre.class.php' ;
// initialisation de variables
73,11 → 73,20
$lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
}
}
return $titre.'<table>'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
return $titre.'<table id="arbre">'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log:$
* $Log: not supported by cvs2svn $
* Revision 1.2.2.1 2007/04/11 14:26:00 alexandre_tb
* ajout d'un include de projet.class.php et participe.class.php pour limiter le nombre de fichier inclu par projetControleur.class.php
*
* Revision 1.2 2006/03/02 16:07:17 alexandre_tb
* ajout d'un id pour l'arbre
*
* Revision 1.1 2005/11/25 14:47:51 alexandre_tb
* version initiale
*
 
*
*
/trunk/bibliotheque/images/tela.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/bibliotheque/images/tela.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/bibliotheque/images/logo_tb_pr_wikini.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/js/telechargement.js
16,7 → 16,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
// CVS : $Id: telechargement.js,v 1.2 2007-06-25 12:15:07 alexandre_tb Exp $
/**
* Application projet
*
28,7 → 28,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2007
*@version $Revision:$
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
var dojoConfig = {
/trunk/projet_derniers_telechargements.php
1,205 → 1,202
<?php
 
/* +-----------------------------------------------------------------------+
* |projet_derniers_telechargement.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2005 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Affiche les derniers fichiers uploader dans le module projet |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: projet_derniers_telechargements.php,v 1.4.2.1 2007-05-11 13:59:27 alexandre_tb Exp $
*/
 
// Cette application affiche les derniers documents uploades dans le module projet
// ainsi que tous les documents du module
 
// ===========================================================
// Configuration
// ===========================================================
 
 
// Le nombre a afficher
define ("PROJET_TELECHARGEMENT_NOMBRE", 8) ;
 
//==================== Les labels =======================================
define ("PROJET_TELECHARGEMENT_TITRE", "Page de t&eacute;l&eacute;chargements rapides") ;
define ("PROJET_TELECHARGEMENT_DERNIERS", "Derniers documents mis en ligne") ;
define ("PROJET_TELECHARGEMENT_TOUS", "Tous les documents, par projet") ;
 
//=============bibliotheques PEAR ===================================
include_once 'HTML/Table.php' ;
 
// ========== Bibliotheque Projet ====================================
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.inc.php' ;
 
 
function afficherContenuCorps() {
global $id_projet, $repcourant, $baseURL, $projet ;
if (isset($_GET['service'])) {
if ($_GET['service'] == 'ecouteArbreFichier') {
include_once PROJET_CHEMIN_APPLI.'/services/ecouteArbreFichier.php';
}
if ($_GET['service'] == 'telechargement') {
include_once PROJET_CHEMIN_APPLI.'/services/telechargement.php';
}
}
// a remplacer par un div pour genesia
$res = "<h1>".PROJET_TELECHARGEMENT_TITRE."</h1>\n" ;
$res .= "<h2>".PROJET_TELECHARGEMENT_DERNIERS."</h2>\n" ;
$liste_documents = document::getDocumentsRecents( $nombre = 10, $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER,PROJET_CHEMIN_ICONES) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$vue_liste_document = new HTML_listeDocuments($GLOBALS['url'], false, '', $GLOBALS['projet_auth']) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $GLOBALS['projet_db']) ;
$res .= $vue_liste_document->toHTML('', PROJET_DROIT_AUCUN) ;
$res .= "<h2>".PROJET_TELECHARGEMENT_TOUS."</h2>\n" ;
 
// Les noms des fichiers graphiques
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$i = 0 ;
// Requete sur les projets
$requete = "SELECT p_titre, p_id FROM projet ORDER BY p_titre" ;
$resultat = $GLOBALS['projet_db']->query ($requete) or die ("Echec <br />".mysql_error()."<br />$requete") ;
$noeudProjet = '' ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$titre = $ligne->p_titre ;
$i++ ;
$noeudProjet .= '<div dojoType="TreeNode" title="'.$ligne->p_titre.'" widgetId="projet_'.
$ligne->p_id.'" objectId="projet_'.$ligne->p_id.'" isFolder="true"></div>'."\n";
}
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', PROJET_CHEMIN_APPLI.'js/telechargement.js');
//$res .= '<p>' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $GLOBALS['url']->getURL();
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" DNDMode="between" selector="treeSelector" widgetId="bandTree" controller="treeController">
<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true">'."\n".
$noeudProjet.'</div></div>';
//$res .= '</p>';
return $res ;
}
 
/** fonction projet_fichiers() - Remplie un noeud avec les fichiers et repertoires
*
* Le noeud est passe en reference. Ainsi, cette fonction ne retourne rien mais modifie le tableau des
* noeuds passe en reference.
*
* return void
*/
 
function projet_fichiers ($noeud, $id_rep, $pere = 0)
{
//Recuperation de l'identifiant du repertoire courant
//La fonction est appele recursivement quand $pere ne vaut pas null
//$id_rep prend donc la valeur de $pere transmise par l'appel precedent de la fonction.
// Les noms des fichiers graphiques
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
//Requ�te pour r�cup�rer les noms des r�pertoires contenus dans le r�pertoire courant ($id_rep)
$queryRep = ' SELECT projet_documents.*'.
' FROM projet_documents'.
' WHERE projet_documents.pd_pere = '.$GLOBALS['projet_db']->escapeSimple($pere).
' AND projet_documents.pd_visibilite = "public" and pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_rep).' and pd_ce_type=0'.
' ORDER BY projet_documents.pd_nom ASC' ;
 
$resultRep = $GLOBALS['projet_db']->query($queryRep) ;
if (DB::isError ($resultRep)) {
die ('Echec de la requete : '.$queryRep.'<br />'.$resultRep->getMessage()) ;
}
//Stockage des informations sur les r�pertoires contenu dans le r�pertoire courant pour affichage dans un arbre.
//Et appel r�cursif de la fonction pour examiner le contenu de chaque r�pertoire du r�pertoire courant.
if ( $resultRep->numRows() != 0 ) {
while ( $ligneRep = $resultRep->fetchRow(DB_FETCHMODE_OBJECT) ) {
//Stockage des informations sur le r�pertoire courant
$noeud1_1 = &$noeud->addItem(new HTML_TreeNode(
array(
'text' => trim ($ligneRep->pd_nom),
'link' => "", 'icon' => $icon,
'expandedIcon' => $expandedIcon ) ) );
//Appel r�cursif de fonction courante
projet_fichiers (&$noeud1_1, $id_rep, $ligneRep->pd_id) ;
}
}
// Requ�te pour r�cup�rer les fichiers du r�pertoire courant ($id_rep) et leurs informations
$requete_fichiers = 'SELECT projet_documents.*, gen_type_de_fichier.gtf_type_icone'.
' FROM projet_documents, gen_type_de_fichier'.
' WHERE projet_documents.pd_ce_type= gen_type_de_fichier.gtf_id_type'.
' AND projet_documents.pd_visibilite= "public" ' ;
if ($pere == 0) {
$requete_fichiers .= ' AND projet_documents.pd_ce_projet= '.$GLOBALS['projet_db']->escapeSimple($id_rep).' and pd_pere=0 and pd_ce_type <> 0' ;
} else {
$requete_fichiers .= ' AND projet_documents.pd_pere= '.$GLOBALS['projet_db']->escapeSimple($pere).' and pd_ce_type<>0' ;
}
$requete_fichiers .= ' ORDER BY projet_documents.pd_nom ASC' ;
 
$resultat_fichiers = $GLOBALS['projet_db']->query($requete_fichiers) ;
if (DB::isError ($resultat_fichiers)) {
die ('Echec de la requete : '.$requete_fichiers.'<br />'.$resultat_fichiers->getMessage()) ;
}
//Stockage des informations sur les fichiers du r�pertoires courant pour affichage dans un arbre
if ( $resultat_fichiers->numRows() != 0 ) {
while ( $ligne_fichiers = $resultat_fichiers->fetchRow(DB_FETCHMODE_OBJECT) ) {
//Ajout de slash devant les caract�res sp�ciaux et suppression des caract�res invisibles en d�but et fin des noms de fichier.
$lien = trim( $ligne_fichiers->pd_nom );
$noeud_1_2 = &$noeud->addItem (new HTML_TreeNode (
array (
"text" => $lien,
"link" => PROJET_CHEMIN_FICHIER.$ligne_fichiers->pd_lien,
'icon' => $ligne_fichiers->gtf_type_icone,
"linkTarget" => "_blank" ))) ;
}
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: projet_derniers_telechargements.php,v $
* Revision 1.4.2.1 2007-05-11 13:59:27 alexandre_tb
* adaptation a ecouteArbreFichier qui est maintenant appele par papyrus.php
*
* Revision 1.4 2007/04/19 09:17:35 alexandre_tb
* utilisation de dojo pour afficher l arbre des derniers documents
*
* Revision 1.3 2005/10/06 08:23:48 alexandre_tb
* Ajout de commentaires
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
<?php
 
/* +-----------------------------------------------------------------------+
* |projet_derniers_telechargement.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2005 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Affiche les derniers fichiers uploader dans le module projet |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: projet_derniers_telechargements.php,v 1.5 2007-06-25 12:15:06 alexandre_tb Exp $
*/
 
// Cette application affiche les derniers documents uploades dans le module projet
// ainsi que tous les documents du module
 
// ===========================================================
// Configuration
// ===========================================================
 
 
// Le nombre a afficher
define ("PROJET_TELECHARGEMENT_NOMBRE", 8) ;
 
//==================== Les labels =======================================
define ("PROJET_TELECHARGEMENT_TITRE", "Page de t&eacute;l&eacute;chargements rapides") ;
define ("PROJET_TELECHARGEMENT_DERNIERS", "Derniers documents mis en ligne") ;
define ("PROJET_TELECHARGEMENT_TOUS", "Tous les documents, par projet") ;
 
//=============bibliotheques PEAR ===================================
include_once 'HTML/Table.php' ;
 
// ========== Bibliotheque Projet ====================================
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.inc.php' ;
 
 
function afficherContenuCorps() {
global $id_projet, $repcourant, $baseURL, $projet ;
if (isset($_GET['service'])) {
if ($_GET['service'] == 'ecouteArbreFichier') {
include_once PROJET_CHEMIN_APPLI.'/services/ecouteArbreFichier.php';
}
if ($_GET['service'] == 'telechargement') {
include_once PROJET_CHEMIN_APPLI.'/services/telechargement.php';
}
}
// a remplacer par un div pour genesia
$res = "<h1>".PROJET_TELECHARGEMENT_TITRE."</h1>\n" ;
$res .= "<h2>".PROJET_TELECHARGEMENT_DERNIERS."</h2>\n" ;
$liste_documents = document::getDocumentsRecents( $nombre = 10, $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER,PROJET_CHEMIN_ICONES) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$vue_liste_document = new HTML_listeDocuments($GLOBALS['url'], false, '', $GLOBALS['projet_auth']) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $GLOBALS['projet_db']) ;
$res .= $vue_liste_document->toHTML('', PROJET_DROIT_AUCUN) ;
$res .= "<h2>".PROJET_TELECHARGEMENT_TOUS."</h2>\n" ;
 
// Les noms des fichiers graphiques
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$i = 0 ;
// Requete sur les projets
$requete = "SELECT p_titre, p_id FROM projet ORDER BY p_titre" ;
$resultat = $GLOBALS['projet_db']->query ($requete) or die ("Echec <br />".mysql_error()."<br />$requete") ;
$noeudProjet = '' ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$titre = $ligne->p_titre ;
$i++ ;
$noeudProjet .= '<div dojoType="TreeNode" title="'.$ligne->p_titre.'" widgetId="projet_'.
$ligne->p_id.'" objectId="projet_'.$ligne->p_id.'" isFolder="true"></div>'."\n";
}
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', PROJET_CHEMIN_APPLI.'js/telechargement.js');
//$res .= '<p>' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $GLOBALS['url']->getURL();
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" DNDMode="between" selector="treeSelector" widgetId="bandTree" controller="treeController">
<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true">'."\n".
$noeudProjet.'</div></div>';
//$res .= '</p>';
return $res ;
}
 
/** fonction projet_fichiers() - Remplie un noeud avec les fichiers et repertoires
*
* Le noeud est passe en reference. Ainsi, cette fonction ne retourne rien mais modifie le tableau des
* noeuds passe en reference.
*
* return void
*/
 
function projet_fichiers ($noeud, $id_rep, $pere = 0)
{
//Recuperation de l'identifiant du repertoire courant
//La fonction est appele recursivement quand $pere ne vaut pas null
//$id_rep prend donc la valeur de $pere transmise par l'appel precedent de la fonction.
// Les noms des fichiers graphiques
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
//Requête pour récupérer les noms des répertoires contenus dans le répertoire courant ($id_rep)
$queryRep = ' SELECT projet_documents.*'.
' FROM projet_documents'.
' WHERE projet_documents.pd_pere = '.$GLOBALS['projet_db']->escapeSimple($pere).
' AND projet_documents.pd_visibilite = "public" and pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_rep).' and pd_ce_type=0'.
' ORDER BY projet_documents.pd_nom ASC' ;
 
$resultRep = $GLOBALS['projet_db']->query($queryRep) ;
if (DB::isError ($resultRep)) {
die ('Echec de la requete : '.$queryRep.'<br />'.$resultRep->getMessage()) ;
}
//Stockage des informations sur les répertoires contenu dans le répertoire courant pour affichage dans un arbre.
//Et appel récursif de la fonction pour examiner le contenu de chaque répertoire du répertoire courant.
if ( $resultRep->numRows() != 0 ) {
while ( $ligneRep = $resultRep->fetchRow(DB_FETCHMODE_OBJECT) ) {
//Stockage des informations sur le répertoire courant
$noeud1_1 = &$noeud->addItem(new HTML_TreeNode(
array(
'text' => trim ($ligneRep->pd_nom),
'link' => "", 'icon' => $icon,
'expandedIcon' => $expandedIcon ) ) );
//Appel récursif de fonction courante
projet_fichiers (&$noeud1_1, $id_rep, $ligneRep->pd_id) ;
}
}
// Requête pour récupérer les fichiers du répertoire courant ($id_rep) et leurs informations
$requete_fichiers = 'SELECT projet_documents.*, gen_type_de_fichier.gtf_type_icone'.
' FROM projet_documents, gen_type_de_fichier'.
' WHERE projet_documents.pd_ce_type= gen_type_de_fichier.gtf_id_type'.
' AND projet_documents.pd_visibilite= "public" ' ;
if ($pere == 0) {
$requete_fichiers .= ' AND projet_documents.pd_ce_projet= '.$GLOBALS['projet_db']->escapeSimple($id_rep).' and pd_pere=0 and pd_ce_type <> 0' ;
} else {
$requete_fichiers .= ' AND projet_documents.pd_pere= '.$GLOBALS['projet_db']->escapeSimple($pere).' and pd_ce_type<>0' ;
}
$requete_fichiers .= ' ORDER BY projet_documents.pd_nom ASC' ;
 
$resultat_fichiers = $GLOBALS['projet_db']->query($requete_fichiers) ;
if (DB::isError ($resultat_fichiers)) {
die ('Echec de la requete : '.$requete_fichiers.'<br />'.$resultat_fichiers->getMessage()) ;
}
//Stockage des informations sur les fichiers du répertoires courant pour affichage dans un arbre
if ( $resultat_fichiers->numRows() != 0 ) {
while ( $ligne_fichiers = $resultat_fichiers->fetchRow(DB_FETCHMODE_OBJECT) ) {
//Ajout de slash devant les caractères spéciaux et suppression des caractères invisibles en début et fin des noms de fichier.
$lien = trim( $ligne_fichiers->pd_nom );
$noeud_1_2 = &$noeud->addItem (new HTML_TreeNode (
array (
"text" => $lien,
"link" => PROJET_CHEMIN_FICHIER.$ligne_fichiers->pd_lien,
'icon' => $ligne_fichiers->gtf_type_icone,
"linkTarget" => "_blank" ))) ;
}
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2007/04/19 09:17:35 alexandre_tb
* utilisation de dojo pour afficher l arbre des derniers documents
*
* Revision 1.3 2005/10/06 08:23:48 alexandre_tb
* Ajout de commentaires
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/trunk/icones/repondre.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/modifier.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/doczip.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/cross.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/pdf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/cancel.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/etoile_grise.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/docpsd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/left-arrow.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/trait-fin.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/ico-cd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/logoff.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/trait.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/opendir.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/icones/Tela.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/projetRSS.php
1,47 → 1,77
<?php
// declare(encoding='UTF-8');
/**
* Description :
*
* @package projet
// Auteur principal :
* @author Grégoire Duché <gregoire@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $$Id$$
* @copyright 1999-2010 Tela Botanica (accueil@tela-botanica.org)
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// inclure les fichiers de configuration de projet pour obtenir la connextion a la BDD
include_once 'configuration/projet.config.inc.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS DU PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
function afficherContenuCorps() {
// Sélection de la page projet
$requete_projets = 'select p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'.
' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '.
' ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'.
' projet left join projet_lien_liste on p_id=pl_id_projet'.
' left join projet_lien_liste_externe on p_id=plle_id_projet'.
' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'.
' group by p_id order by p_titre desc' ;
$resultat_type = $GLOBALS['projet_db']->query($requete_type) or die('ERREUR BDD');
 
ob_start();
include_once('squelettes/rss.tpl.html');
$res = ob_get_contents();
ob_end_clean();
 
return $res;
}
 
 
?>
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projetRSS.php,v 1.2 2005-10-28 07:34:32 florian Exp $
/**
* Générateur de flux RSS à partir du bazar
*
*@package bazar
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/projet.inc.php'; //fichier de configuration de Bazar
include_once 'bibliotheque/projet.fonct.rss.php'; //fichier des fonctions RSS de Bazar
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS DU PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if (isset($_GET['domaine'])) {
$domaine=$_GET['domaine'];
}
else {
$domaine='';
}
if (isset($_GET['nbitem'])) {
$nbitem=$_GET['nbitem'];
}
else {
$nbitem='';
}
if (isset($_GET['liste'])) {
$liste=$_GET['liste'];
}
else {
$liste='';
}
 
echo html_entity_decode(gen_RSS($domaine, $nbitem, $liste));
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/10/25 13:50:34 alexandre_tb
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/services/projet_statistiques.php
1,405 → 1,405
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id:$
/**
* Application projet
*
* Script pour calculer les statistiques
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Julien Grillot <julien.grillot@gmail.com>
*@copyright Tela-Botanica 2000-2005
*@version $Revision:$
// +------------------------------------------------------------------------------------------------------+
*/
 
 
/** AVERTISSEMENT
*
* Ce programme n est pas appele par l application projet
* Il faut le lancer en ligne de commande
*/
define ('PROJET_STATISTIQUE_MODE_LIGNE_COMMANDE', true);
/** Chemin vers les programmes ezmlm en PHP */
define ('PROJET_CHEMIN_EZMLM_PHP', '/home/vpopmail/www/');
/** Chemin vers le site hebergeant l appli projet*/
define ('PROJET_CHEMIN_SITE_APPLI_PROJET', '/home/telabotap/www/');
/** Chemin vers les wikinis pour les flux rss */
define('PROJET_URL_WIKINI', "http://www.tela-botanica.org/wikini/");
/** Chemin vers les flux rss de Yahoo! */
define ('PROJET_URL_RSS_YAHOO', 'http://rss.groups.yahoo.com/group/');
/** Chemin vers les groupes Yahoo! */
define ('PROJET_URL_GROUPES_YAHOO', 'http://fr.groups.yahoo.com/group/');
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Connexion base de donne */
 
if (PROJET_STATISTIQUE_MODE_LIGNE_COMMANDE) {
set_include_path(get_include_path().':'.PROJET_CHEMIN_SITE_APPLI_PROJET.'api/pear/');
define ('GEN_CHEMIN_API', '/home/telabotap/www/api/');
include_once PROJET_CHEMIN_SITE_APPLI_PROJET.'papyrus/configuration/pap_config.inc.php';
$dsn = PAP_DSN;
include_once 'DB.php';
$GLOBALS['projet_db'] = DB::connect($dsn);
if (PEAR::isError($GLOBALS['projet_db'])) die ("\n".'Erreur de connexion a la BD.'."\n".$GLOBALS['projet_db']->getMessage());
else echo "\n"."connection ok...";
// Quelques constantes de chemin
include_once PROJET_CHEMIN_SITE_APPLI_PROJET.'client/projet/configuration/projet.config.inc.php';
 
if (DB::isError($GLOBALS['projet_db'])) die ("\n".'Erreur de connexion a la BD.'."\n".$GLOBALS['projet_db']->getMessage());
} else {
$GLOBALS['projet_db'] = &$this->_db;
}
 
 
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/XML/RSS.php';
 
// Ne pas changer : les groupes Yahoo se basent toujours sur la semaine
define("NB_SEC_INSERT", 7*24*3600);
define("NB_SEC_UPDATE", 2*3600);
 
 
function is_natural($val, $acceptzero = false) {
$return = ((string)$val === (string)(int)$val);
if ($acceptzero)
$base = 0;
else
$base = 1;
if ($return && intval($val) < $base)
$return = false;
return $return;
}
if(!is_natural($_GET['start']))$_GET['start']='0';
 
 
 
 
/**
* Procedure retrouvant le nombre de contribution, de message et le contenu de la page a partir des informations de la BDD
* @param object $ligne resultat d'un fetch row contenant l'url du document a analyser
* @param int $nombre_contrib recupere le nombre de contributions du projet
* @param int $nombre_message recupere le nombre de nouveaux messages du projet
* @param int $nombre_membre recupere le nombre de nouveaux messages du projet
* @param int $nombre_photo recupere le nombre de nouveaux messages du projet
* @return false si la fonction echoue lors de la tentative de recuperation des donnees utiles
*/
function analyser($ligne, &$nombre_contrib, &$nombre_message, &$nombre_nouveau_membre, &$nombre_photo, &$nombre_membre) {
$nombre_contrib='0';
$nombre_msg='0';
$r=false;
 
// Recuperation du nbre de message
$domaine = $ligne->pl_domaine;
$liste = $ligne->pl_nom_liste;
if ($domaine != '' && $liste != '') {
ob_start();
include PROJET_CHEMIN_EZMLM_PHP.'nombre_messages.php';
$xml = ob_get_contents();
ob_end_clean();
if (isset($xml) && $xml != '' && $xml != 0) {
$simpleXML = simplexml_load_string($xml);
$nombre_message = $simpleXML[0];
}
}
if(!$nombre_message)$nombre_message='0';
// Si AGO_A_NOMGRP existe, la liste est sur Yahoo
// on essaie de parser la page d accueil du groupe
// poue recuperer les
if($ligne->AGO_A_NOMGRP) {
$url = PROJET_URL_GROUPES_YAHOO.$ligne->AGO_A_NOMGRP;
 
// Recherche du schema retrouvant le nombre de nouveaux message dans la semaine
$pattern_membres = '(: ([0-9]+) </li>)((<li>Rubriqu)|( <li>Cr))';
$pattern_nouveaux_membres = '>([0-9]+)</span> .ouveaux? .embres?';
$pattern_message = '>([0-9]+)</span> .ouveaux? .essages?';
$pattern3 = '>([0-9]+)</span> .ouvelles? .hotos?';
$contenu = @file_get_contents($url);
// en cas d echec, ce qui est frequent
// on lit le flux rss
if ($contenu) {
sleep(2);
$r=($contenu?true:false);
ereg($pattern_message, $contenu, $registre_message);
$nombre_message=$registre_message[1];
ereg($pattern_nouveaux_membres, $contenu, $registre_nouveau_membre);
$nombre_nouveau_membre=$registre_nouveau_membre[1];
ereg($pattern3, $contenu, $no);
$nombre_photo=$no[1];
ereg ($pattern_membres, $contenu, $registre_membre);
$nombre_membre = $registre_membre[2];
} else {
// Parse le flux RSS genere par wikini
$rss =& new XML_RSS(PROJET_URL_RSS_YAHOO.$ligne->AGO_A_NOMGRP.'/rss');
if (PEAR::isError($rss)) {
echo $rss->getMessage()."\n";
return;
}
$rss->parse();
// On va compter le nombre de modification depuis les x derniers jours (voirs constantes)
foreach ($rss->getItems() as $item) {
// Le script doit etre compatiable avec plusieurs formats de date
if ($item['pubDate']) {
if (strtotime($item['pubDate'])>time()-NB_SEC_INSERT) $nombre_message++;
} else {
$date = substr($item['title'], strlen($item['title'])-18);
if ($date>date("Y m d - H:i", time()-NB_SEC_INSERT)) $nombre_message++;
}
}
// On met une * dans les autres variables pour indiquer que ca ne fonctionne pas
$nombre_membre = '*';
$nombre_photo = '*';
}
} else {
// Parse le flux RSS genere par wikini
$rss =& new XML_RSS(PROJET_URL_WIKINI.$ligne->p_wikini.'/wakka.php?wiki=DerniersChangementsRSS/xml');
$rss->parse();
// On va compter le nombre de modification depuis les x derniers jours (voirs constantes)
foreach ($rss->getItems() as $item) {
// Le script doit etre compatiable avec plusieurs formats de date
if ($item['pubDate']) {
if (strtotime($item['pubDate'])>time()-NB_SEC_INSERT) $nombre_contrib++;
} else {
$date = substr($item['title'], strlen($item['title'])-18);
if ($date>date("Y m d - H:i", time()-NB_SEC_INSERT)) $nombre_contrib++;
}
}
// On recupere le nombre de nouveaux inscrit au projet
$r=true;
// Nombre de derniers messages de la semaine
$domaine = $ligne->pl_domaine;
$liste = $ligne->pl_liste;
ob_start();
include_once PROJET_CHEMIN_EZMLM_PHP.'dernier_messages.php';
ob_end_clean();
$nombre_message = $num; // $num est une variable du fichier dernier_messages.php
}
return $r;
}
 
// Pour calculer le temps d'execution du script
$start=microtime(true);
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// requete pour recuperer la liste des projets
$requete = 'select count(distinct psu_id_utilisateur) as nb_utilisateur, count(distinct pil_id_utilisateur) as nb_utilisateur_liste, count(distinct projet_documents.pd_id) as nb_doc, p_wikini, ' .
'p_id, p_titre, p_resume, projet_lien_liste.pl_id_liste, pl_domaine,pl_nom_liste,AGO_A_NOMGRP ' .
'from projet left join projet_lien_liste on p_id=projet_lien_liste.pl_id_projet ' .
'left join projet_liste on projet_lien_liste.pl_id_liste=projet_liste.pl_id_liste ' .
'left join projet_inscription_liste on (projet_inscription_liste.pil_id_liste=projet_liste.pl_id_liste and pil_date_inscription > date_sub(now(), interval 1 week)) ' .
'left join projet_documents on (p_id=pd_ce_projet and pd_date_de_mise_a_jour > date_sub(now(), interval 1 week)) ' .
'left join projet_statut_utilisateurs on p_id=psu_id_projet ' .
'left join projet_lien_liste_externe on plle_id_projet=p_id ' .
'left join agora on plle_id_liste=AGO_A_ID ' .
'group by p_id order by p_titre' ;
 
$resultat = $GLOBALS['projet_db']->query($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
echo "\n".'Statistiques des projets';
echo "\n".'Requete : '."\n\n".$requete."\n";
 
 
$calculs = false;
 
 
printf ("\n%-56s %-35s %-12s %-12s %-12s %-12s %-12s %-12s",
"Nom du projet", "Nom liste", "Nouv inscrits", "Utilisateurs", "Nb messages", "Nb doc", "Nb contrib", 'Nombre inscrit Yahoo');
$nombre_photo = 0;
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$nombre_contrib = 0;
$nombre_message = 0;
$nombre_nouveau_membre = 0;
$nombre_membre_yahoo = 0;
// On verifie la date de derniere mise a jour
$requete_verif='SELECT * FROM projet_statistiques WHERE ps_ce_projet="'.$ligne->p_id.'" ORDER BY ps_date DESC LIMIT 1';
$resultat_verif = $GLOBALS['projet_db']->query($requete_verif);
if (DB::isError($resultat_verif)) {
echo $resultat_verif->getMessage().$resultat_verif;
}
$ligne_verif = $resultat_verif->fetchRow(DB_FETCHMODE_OBJECT);
// Si elle remonte a plus de deux heure, on sauvegarde, et a plus de 7 jours, on archive et cree une nouvelle entree
if($ligne_verif->ps_date > date("Y-m-d H:i:s", time()-NB_SEC_INSERT)) {
if($ligne_verif->ps_maj < date("Y-m-d H:i:s", time()-NB_SEC_UPDATE)) {
// Recupere nombre_contrib et nombre_message
$calculs=analyser($ligne, $nombre_contrib, $nombre_message, $nombre_nouveau_membre, $nombre_photo, $nombre_membre_yahoo);
$requete_maj = 'UPDATE projet_statistiques SET ps_msg_derniere_semaine="'.$nombre_message.'", ps_doc_derniere_semaine="'.
$ligne->nb_doc.'", ps_nombre_inscrit_derniere_semaine="'.$nombre_nouveau_membre.'", ps_nombre_inscrit="'.$ligne->nb_utilisateur.
'", ps_nombre_inscrit_liste="'.
$ligne->nb_utilisateur_liste.'", ps_modifwiki_derniere_semaine="'.$nombre_contrib.
'", ps_maj=NOW(), ps_nombre_membre_yahoo="'.$nombre_membre_yahoo.'" WHERE ps_ce_projet="'.
$ligne->p_id.'" AND ps_dernier="1"';
$resultat_maj = $GLOBALS['projet_db']->query($requete_maj);
if (DB::isError($resultat_maj)) {
echo $resultat_maj->getMessage().$requete_maj;
}
} else {
$nombre_contrib = $ligne_verif->ps_modifwiki_derniere_semaine;
$nombre_message = $ligne_verif->ps_msg_derniere_semaine;
}
} else {
// Recupere nombre_contrib et nombre_message
$calculs=analyser($ligne, $nombre_contrib, $nombre_message, $nombre_nouveau_membre, $nombre_photo, $nombre_membre_yahoo);
// On place ps_dernier a O pour les stats de la semaine precedente
$requete_stat_prec = 'update projet_statistiques set ps_dernier=0 where ps_ce_projet='.$ligne->p_id;
$resultat_stat_prec = $GLOBALS['projet_db']->query($requete_stat_prec);
$requete_maj = 'INSERT INTO projet_statistiques set ps_ce_projet="'.$ligne->p_id.'", ps_msg_derniere_semaine="'.$nombre_message
.'", ps_doc_derniere_semaine="'.$ligne->nb_doc.'", ps_nombre_inscrit_derniere_semaine="'.$nombre_nouveau_membre.
'", ps_nombre_inscrit= "'.$ligne->nb_utilisateur.'", ps_nombre_inscrit_liste="'.$ligne->nb_utilisateur_liste.
'", ps_modifwiki_derniere_semaine="'.$nombre_contrib.'", ps_date=now(), ps_maj=now(), ps_dernier=1'.
', ps_nombre_membre_yahoo="'.$nombre_membre_yahoo.'"';
$resultat_maj = $GLOBALS['projet_db']->query($requete_maj);
if (DB::isError($resultat_maj)) {
echo $resultat_maj->getMessage().$requete_maj;
}
}
// Et on affiche les stats courantes
$format = "\n%-56s %-35s %-12d %-12d %-12d %-12d %-12d %-12d";
printf ($format, html_entity_decode($ligne->p_titre), ($ligne->pl_nom_liste?$ligne->pl_nom_liste:$ligne->AGO_A_NOMGRP.' (Yahoo)'),
$nombre_nouveau_membre, $ligne->nb_utilisateur, $nombre_message, $ligne->nb_doc, $nombre_contrib, $nombre_membre_yahoo);
 
}
//$res .= '</table>';
 
// Met a jour les statistiques et somme d'activite
$sql="update `projet_statistiques` set ps_somme=(ps_msg_derniere_semaine +5*ps_doc_derniere_semaine+ps_nombre_inscrit_liste+ps_modifwiki_derniere_semaine);";
$resultat = $GLOBALS['projet_db']->query($sql);
if (DB::isError($resultat)) {
return $resultat->getMessage().$sql;
}
 
// On cherche le max pour ponderer les sommes
$sql='SELECT MAX( LN(ps_somme+1) ) AS max FROM projet_statistiques WHERE ps_dernier=1';
$resultat = $GLOBALS['projet_db']->query($sql);
if (DB::isError($resultat)) {
return $resultat->getMessage().$sql;
}
$tresultat = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
$max = $tresultat->max;
// On pondere
$sql = 'UPDATE projet_statistiques SET ps_pourcent=LN(ps_somme+1) / '.$max.' * 100 WHERE ps_dernier=1';
$resultat = $GLOBALS['projet_db']->query($sql);
if (DB::isError($resultat)) {
return $resultat->getMessage().$sql;
}
 
// Calcul de al dormance de certains projets
$requete_dormance = 'select ps_ce_projet from projet_statistiques where ps_ce_projet not in '.
'(SELECT ps_ce_projet FROM `projet_statistiques` WHERE `ps_somme` <> 0 group by ps_ce_projet) group by ps_ce_projet';
$resultat_dormance = $GLOBALS['projet_db']->query ($requete_dormance);
 
echo "\n".'Mise a jour de la dormance...'."\n";
 
while ($ligne_dormance = $resultat_dormance->fetchRow(DB_FETCHMODE_OBJECT)) {
// Comme les statistiques n'ont pas un an, on verifie s'il n'y pas de documents
$requete_complementaire = 'select pd_id from projet_documents where pd_date_de_mise_a_jour > date_sub(now(), interval 1 year) and pd_ce_projet = '
.$ligne_dormance->ps_ce_projet;
$resultat_complementaire = $GLOBALS['projet_db']->query ($requete_complementaire);
if (DB::isError($resultat_complementaire)) {
echo $resultat_complementaire->getMessage()."\n".$resultat_complementaire->getDebugInfo()."\n".'Requete : '.$requete_complementaire."\n";
}
if ($resultat_complementaire->numRows() !=0) { // Le projet a eu una activite meme infime depuis un an
$requete_projet = 'update projet set p_en_dormance=0 where p_id='.$ligne_dormance->ps_ce_projet;
$GLOBALS['projet_db']->query($requete_projet);
// Suppression puis insertion
$requete_avoir_theme = 'delete from projet_avoir_theme where pat_id_projet='.$ligne_dormance->ps_ce_projet.' and pat_id_theme=9';
$GLOBALS['projet_db']->query ($requete_avoir_theme);
} else { // Le projet dort on fait les mises a jour sur projet et projet_avoir_theme
$requete_projet = 'update projet set p_en_dormance=1 where p_id='.$ligne_dormance->ps_ce_projet;
$GLOBALS['projet_db']->query($requete_projet);
// Suppression puis insertion
$requete_avoir_theme = 'delete from projet_avoir_theme where pat_id_projet='.$ligne_dormance->ps_ce_projet.' and pat_id_theme=9';
$GLOBALS['projet_db']->query ($requete_avoir_theme);
$requete_avoir_theme = 'insert into projet_avoir_theme set pat_id_projet='.$ligne_dormance->ps_ce_projet.', pat_id_theme=9'; // Le theme en dormance
$GLOBALS['projet_db']->query ($requete_avoir_theme);
}
}
 
// On affiche quelques infos inutiles mais indispensables
echo "\n";
if(!$calculs) $res .= 'Les variables nb_msg et nb_contrib n\'ont pas &eacute;t&eacute; calcul&eacute;es (datent de moins de '.round(NB_SEC_UPDATE/3600).' heures)'."\n";
echo 'Execut&eacute; en '.(round((microtime(true)-$start)*1000)/1000).' secondes.'."\n";
 
if (PROJET_STATISTIQUE_MODE_LIGNE_COMMANDE) {
 
} else {
return $res;
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log:$
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet_statistiques.php,v 1.3 2008-08-25 14:59:22 alexandre_tb Exp $
/**
* Application projet
*
* Script pour calculer les statistiques
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Julien Grillot <julien.grillot@gmail.com>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
/** AVERTISSEMENT
*
* Ce programme n est pas appele par l application projet
* Il faut le lancer en ligne de commande
*/
define ('PROJET_STATISTIQUE_MODE_LIGNE_COMMANDE', true);
/** Chemin vers les programmes ezmlm en PHP */
define ('PROJET_CHEMIN_EZMLM_PHP', '/home/vpopmail/www/');
/** Chemin vers le site hebergeant l appli projet*/
define ('PROJET_CHEMIN_SITE_APPLI_PROJET', '/home/telabotap/www/');
/** Chemin vers les wikinis pour les flux rss */
define('PROJET_URL_WIKINI', "http://www.tela-botanica.org/wikini/");
/** Chemin vers les flux rss de Yahoo! */
define ('PROJET_URL_RSS_YAHOO', 'http://rss.groups.yahoo.com/group/');
/** Chemin vers les groupes Yahoo! */
define ('PROJET_URL_GROUPES_YAHOO', 'http://fr.groups.yahoo.com/group/');
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Connexion base de donne */
 
if (PROJET_STATISTIQUE_MODE_LIGNE_COMMANDE) {
set_include_path(get_include_path().':'.PROJET_CHEMIN_SITE_APPLI_PROJET.'api/pear/');
define ('GEN_CHEMIN_API', '/home/telabotap/www/api/');
include_once PROJET_CHEMIN_SITE_APPLI_PROJET.'papyrus/configuration/pap_config.inc.php';
$dsn = PAP_DSN;
include_once 'DB.php';
$GLOBALS['projet_db'] = DB::connect($dsn);
if (PEAR::isError($GLOBALS['projet_db'])) die ("\n".'Erreur de connexion a la BD.'."\n".$GLOBALS['projet_db']->getMessage());
else echo "\n"."connection ok...";
// Quelques constantes de chemin
include_once PROJET_CHEMIN_SITE_APPLI_PROJET.'client/projet/configuration/projet.config.inc.php';
 
if (DB::isError($GLOBALS['projet_db'])) die ("\n".'Erreur de connexion a la BD.'."\n".$GLOBALS['projet_db']->getMessage());
} else {
$GLOBALS['projet_db'] = &$this->_db;
}
 
 
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/XML/RSS.php';
 
// Ne pas changer : les groupes Yahoo se basent toujours sur la semaine
define("NB_SEC_INSERT", 7*24*3600);
define("NB_SEC_UPDATE", 2*3600);
 
 
function is_natural($val, $acceptzero = false) {
$return = ((string)$val === (string)(int)$val);
if ($acceptzero)
$base = 0;
else
$base = 1;
if ($return && intval($val) < $base)
$return = false;
return $return;
}
if(!is_natural($_GET['start']))$_GET['start']='0';
 
 
 
 
/**
* Procedure retrouvant le nombre de contribution, de message et le contenu de la page a partir des informations de la BDD
* @param object $ligne resultat d'un fetch row contenant l'url du document a analyser
* @param int $nombre_contrib recupere le nombre de contributions du projet
* @param int $nombre_message recupere le nombre de nouveaux messages du projet
* @param int $nombre_membre recupere le nombre de nouveaux messages du projet
* @param int $nombre_photo recupere le nombre de nouveaux messages du projet
* @return false si la fonction echoue lors de la tentative de recuperation des donnees utiles
*/
function analyser($ligne, &$nombre_contrib, &$nombre_message, &$nombre_nouveau_membre, &$nombre_photo, &$nombre_membre) {
$nombre_contrib='0';
$nombre_msg='0';
$r=false;
 
// Recuperation du nbre de message
$domaine = $ligne->pl_domaine;
$liste = $ligne->pl_nom_liste;
if ($domaine != '' && $liste != '') {
ob_start();
include PROJET_CHEMIN_EZMLM_PHP.'nombre_messages.php';
$xml = ob_get_contents();
ob_end_clean();
if (isset($xml) && $xml != '' && $xml != 0) {
$simpleXML = simplexml_load_string($xml);
$nombre_message = $simpleXML[0];
}
}
if(!$nombre_message)$nombre_message='0';
// Si AGO_A_NOMGRP existe, la liste est sur Yahoo
// on essaie de parser la page d accueil du groupe
// poue recuperer les
if($ligne->AGO_A_NOMGRP) {
$url = PROJET_URL_GROUPES_YAHOO.$ligne->AGO_A_NOMGRP;
 
// Recherche du schema retrouvant le nombre de nouveaux message dans la semaine
$pattern_membres = '(: ([0-9]+) </li>)((<li>Rubriqu)|( <li>Cr))';
$pattern_nouveaux_membres = '>([0-9]+)</span> .ouveaux? .embres?';
$pattern_message = '>([0-9]+)</span> .ouveaux? .essages?';
$pattern3 = '>([0-9]+)</span> .ouvelles? .hotos?';
$contenu = @file_get_contents($url);
// en cas d echec, ce qui est frequent
// on lit le flux rss
if ($contenu) {
sleep(2);
$r=($contenu?true:false);
ereg($pattern_message, $contenu, $registre_message);
$nombre_message=$registre_message[1];
ereg($pattern_nouveaux_membres, $contenu, $registre_nouveau_membre);
$nombre_nouveau_membre=$registre_nouveau_membre[1];
ereg($pattern3, $contenu, $no);
$nombre_photo=$no[1];
ereg ($pattern_membres, $contenu, $registre_membre);
$nombre_membre = $registre_membre[2];
} else {
// Parse le flux RSS genere par wikini
$rss =& new XML_RSS(PROJET_URL_RSS_YAHOO.$ligne->AGO_A_NOMGRP.'/rss');
if (PEAR::isError($rss)) {
echo $rss->getMessage()."\n";
return;
}
$rss->parse();
// On va compter le nombre de modification depuis les x derniers jours (voirs constantes)
foreach ($rss->getItems() as $item) {
// Le script doit etre compatiable avec plusieurs formats de date
if ($item['pubDate']) {
if (strtotime($item['pubDate'])>time()-NB_SEC_INSERT) $nombre_message++;
} else {
$date = substr($item['title'], strlen($item['title'])-18);
if ($date>date("Y m d - H:i", time()-NB_SEC_INSERT)) $nombre_message++;
}
}
// On met une * dans les autres variables pour indiquer que ca ne fonctionne pas
$nombre_membre = '*';
$nombre_photo = '*';
}
} else {
// Parse le flux RSS genere par wikini
$rss =& new XML_RSS(PROJET_URL_WIKINI.$ligne->p_wikini.'/wakka.php?wiki=DerniersChangementsRSS/xml');
$rss->parse();
// On va compter le nombre de modification depuis les x derniers jours (voirs constantes)
foreach ($rss->getItems() as $item) {
// Le script doit etre compatiable avec plusieurs formats de date
if ($item['pubDate']) {
if (strtotime($item['pubDate'])>time()-NB_SEC_INSERT) $nombre_contrib++;
} else {
$date = substr($item['title'], strlen($item['title'])-18);
if ($date>date("Y m d - H:i", time()-NB_SEC_INSERT)) $nombre_contrib++;
}
}
// On recupere le nombre de nouveaux inscrit au projet
$r=true;
// Nombre de derniers messages de la semaine
$domaine = $ligne->pl_domaine;
$liste = $ligne->pl_liste;
ob_start();
include_once PROJET_CHEMIN_EZMLM_PHP.'dernier_messages.php';
ob_end_clean();
$nombre_message = $num; // $num est une variable du fichier dernier_messages.php
}
return $r;
}
 
// Pour calculer le temps d'execution du script
$start=microtime(true);
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// requete pour recuperer la liste des projets
$requete = 'select count(distinct psu_id_utilisateur) as nb_utilisateur, count(distinct pil_id_utilisateur) as nb_utilisateur_liste, count(distinct projet_documents.pd_id) as nb_doc, p_wikini, ' .
'p_id, p_titre, p_resume, projet_lien_liste.pl_id_liste, pl_domaine,pl_nom_liste,AGO_A_NOMGRP ' .
'from projet left join projet_lien_liste on p_id=projet_lien_liste.pl_id_projet ' .
'left join projet_liste on projet_lien_liste.pl_id_liste=projet_liste.pl_id_liste ' .
'left join projet_inscription_liste on (projet_inscription_liste.pil_id_liste=projet_liste.pl_id_liste and pil_date_inscription > date_sub(now(), interval 1 week)) ' .
'left join projet_documents on (p_id=pd_ce_projet and pd_date_de_mise_a_jour > date_sub(now(), interval 1 week)) ' .
'left join projet_statut_utilisateurs on p_id=psu_id_projet ' .
'left join projet_lien_liste_externe on plle_id_projet=p_id ' .
'left join agora on plle_id_liste=AGO_A_ID ' .
'group by p_id order by p_titre' ;
 
$resultat = $GLOBALS['projet_db']->query($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
echo "\n".'Statistiques des projets';
echo "\n".'Requete : '."\n\n".$requete."\n";
 
 
$calculs = false;
 
 
printf ("\n%-56s %-35s %-12s %-12s %-12s %-12s %-12s %-12s",
"Nom du projet", "Nom liste", "Nouv inscrits", "Utilisateurs", "Nb messages", "Nb doc", "Nb contrib", 'Nombre inscrit Yahoo');
$nombre_photo = 0;
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$nombre_contrib = 0;
$nombre_message = 0;
$nombre_nouveau_membre = 0;
$nombre_membre_yahoo = 0;
// On verifie la date de derniere mise a jour
$requete_verif='SELECT * FROM projet_statistiques WHERE ps_ce_projet="'.$ligne->p_id.'" ORDER BY ps_date DESC LIMIT 1';
$resultat_verif = $GLOBALS['projet_db']->query($requete_verif);
if (DB::isError($resultat_verif)) {
echo $resultat_verif->getMessage().$resultat_verif;
}
$ligne_verif = $resultat_verif->fetchRow(DB_FETCHMODE_OBJECT);
// Si elle remonte a plus de deux heure, on sauvegarde, et a plus de 7 jours, on archive et cree une nouvelle entree
if($ligne_verif->ps_date > date("Y-m-d H:i:s", time()-NB_SEC_INSERT)) {
if($ligne_verif->ps_maj < date("Y-m-d H:i:s", time()-NB_SEC_UPDATE)) {
// Recupere nombre_contrib et nombre_message
$calculs=analyser($ligne, $nombre_contrib, $nombre_message, $nombre_nouveau_membre, $nombre_photo, $nombre_membre_yahoo);
$requete_maj = 'UPDATE projet_statistiques SET ps_msg_derniere_semaine="'.$nombre_message.'", ps_doc_derniere_semaine="'.
$ligne->nb_doc.'", ps_nombre_inscrit_derniere_semaine="'.$nombre_nouveau_membre.'", ps_nombre_inscrit="'.$ligne->nb_utilisateur.
'", ps_nombre_inscrit_liste="'.
$ligne->nb_utilisateur_liste.'", ps_modifwiki_derniere_semaine="'.$nombre_contrib.
'", ps_maj=NOW(), ps_nombre_membre_yahoo="'.$nombre_membre_yahoo.'" WHERE ps_ce_projet="'.
$ligne->p_id.'" AND ps_dernier="1"';
$resultat_maj = $GLOBALS['projet_db']->query($requete_maj);
if (DB::isError($resultat_maj)) {
echo $resultat_maj->getMessage().$requete_maj;
}
} else {
$nombre_contrib = $ligne_verif->ps_modifwiki_derniere_semaine;
$nombre_message = $ligne_verif->ps_msg_derniere_semaine;
}
} else {
// Recupere nombre_contrib et nombre_message
$calculs=analyser($ligne, $nombre_contrib, $nombre_message, $nombre_nouveau_membre, $nombre_photo, $nombre_membre_yahoo);
// On place ps_dernier a O pour les stats de la semaine precedente
$requete_stat_prec = 'update projet_statistiques set ps_dernier=0 where ps_ce_projet='.$ligne->p_id;
$resultat_stat_prec = $GLOBALS['projet_db']->query($requete_stat_prec);
$requete_maj = 'INSERT INTO projet_statistiques set ps_ce_projet="'.$ligne->p_id.'", ps_msg_derniere_semaine="'.$nombre_message
.'", ps_doc_derniere_semaine="'.$ligne->nb_doc.'", ps_nombre_inscrit_derniere_semaine="'.$nombre_nouveau_membre.
'", ps_nombre_inscrit= "'.$ligne->nb_utilisateur.'", ps_nombre_inscrit_liste="'.$ligne->nb_utilisateur_liste.
'", ps_modifwiki_derniere_semaine="'.$nombre_contrib.'", ps_date=now(), ps_maj=now(), ps_dernier=1'.
', ps_nombre_membre_yahoo="'.$nombre_membre_yahoo.'"';
$resultat_maj = $GLOBALS['projet_db']->query($requete_maj);
if (DB::isError($resultat_maj)) {
echo $resultat_maj->getMessage().$requete_maj;
}
}
// Et on affiche les stats courantes
$format = "\n%-56s %-35s %-12d %-12d %-12d %-12d %-12d %-12d";
printf ($format, html_entity_decode($ligne->p_titre), ($ligne->pl_nom_liste?$ligne->pl_nom_liste:$ligne->AGO_A_NOMGRP.' (Yahoo)'),
$nombre_nouveau_membre, $ligne->nb_utilisateur, $nombre_message, $ligne->nb_doc, $nombre_contrib, $nombre_membre_yahoo);
 
}
//$res .= '</table>';
 
// Met a jour les statistiques et somme d'activite
$sql="update `projet_statistiques` set ps_somme=(ps_msg_derniere_semaine +5*ps_doc_derniere_semaine+ps_nombre_inscrit_liste+ps_modifwiki_derniere_semaine);";
$resultat = $GLOBALS['projet_db']->query($sql);
if (DB::isError($resultat)) {
return $resultat->getMessage().$sql;
}
 
// On cherche le max pour ponderer les sommes
$sql='SELECT MAX( LN(ps_somme+1) ) AS max FROM projet_statistiques WHERE ps_dernier=1';
$resultat = $GLOBALS['projet_db']->query($sql);
if (DB::isError($resultat)) {
return $resultat->getMessage().$sql;
}
$tresultat = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
$max = $tresultat->max;
// On pondere
$sql = 'UPDATE projet_statistiques SET ps_pourcent=LN(ps_somme+1) / '.$max.' * 100 WHERE ps_dernier=1';
$resultat = $GLOBALS['projet_db']->query($sql);
if (DB::isError($resultat)) {
return $resultat->getMessage().$sql;
}
 
// Calcul de al dormance de certains projets
$requete_dormance = 'select ps_ce_projet from projet_statistiques where ps_ce_projet not in '.
'(SELECT ps_ce_projet FROM `projet_statistiques` WHERE `ps_somme` <> 0 group by ps_ce_projet) group by ps_ce_projet';
$resultat_dormance = $GLOBALS['projet_db']->query ($requete_dormance);
 
echo "\n".'Mise a jour de la dormance...'."\n";
 
while ($ligne_dormance = $resultat_dormance->fetchRow(DB_FETCHMODE_OBJECT)) {
// Comme les statistiques n'ont pas un an, on verifie s'il n'y pas de documents
$requete_complementaire = 'select pd_id from projet_documents where pd_date_de_mise_a_jour > date_sub(now(), interval 1 year) and pd_ce_projet = '
.$ligne_dormance->ps_ce_projet;
$resultat_complementaire = $GLOBALS['projet_db']->query ($requete_complementaire);
if (DB::isError($resultat_complementaire)) {
echo $resultat_complementaire->getMessage()."\n".$resultat_complementaire->getDebugInfo()."\n".'Requete : '.$requete_complementaire."\n";
}
if ($resultat_complementaire->numRows() !=0) { // Le projet a eu una activite meme infime depuis un an
$requete_projet = 'update projet set p_en_dormance=0 where p_id='.$ligne_dormance->ps_ce_projet;
$GLOBALS['projet_db']->query($requete_projet);
// Suppression puis insertion
$requete_avoir_theme = 'delete from projet_avoir_theme where pat_id_projet='.$ligne_dormance->ps_ce_projet.' and pat_id_theme=9';
$GLOBALS['projet_db']->query ($requete_avoir_theme);
} else { // Le projet dort on fait les mises a jour sur projet et projet_avoir_theme
$requete_projet = 'update projet set p_en_dormance=1 where p_id='.$ligne_dormance->ps_ce_projet;
$GLOBALS['projet_db']->query($requete_projet);
// Suppression puis insertion
$requete_avoir_theme = 'delete from projet_avoir_theme where pat_id_projet='.$ligne_dormance->ps_ce_projet.' and pat_id_theme=9';
$GLOBALS['projet_db']->query ($requete_avoir_theme);
$requete_avoir_theme = 'insert into projet_avoir_theme set pat_id_projet='.$ligne_dormance->ps_ce_projet.', pat_id_theme=9'; // Le theme en dormance
$GLOBALS['projet_db']->query ($requete_avoir_theme);
}
}
 
// On affiche quelques infos inutiles mais indispensables
echo "\n";
if(!$calculs) $res .= 'Les variables nb_msg et nb_contrib n\'ont pas &eacute;t&eacute; calcul&eacute;es (datent de moins de '.round(NB_SEC_UPDATE/3600).' heures)'."\n";
echo 'Execut&eacute; en '.(round((microtime(true)-$start)*1000)/1000).' secondes.'."\n";
 
if (PROJET_STATISTIQUE_MODE_LIGNE_COMMANDE) {
 
} else {
return $res;
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/services/ecouteArbreFichier.php
1,170 → 1,170
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: ecouteArbreFichier.php,v 1.2 2007-06-25 12:15:06 alexandre_tb Exp $
/**
* Application projet
*
* Service d ecoute de l arbre du porte document, renvoie les donnees du repertoire demande
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// ATTENTION - le programme suivant doit renvoyer un tableau, meme vide
// sinon l arbre dojo ne fonctionnera pas (ligne 117 $returnArray = array)
 
 
include_once (GEN_CHEMIN_API.'json/JSON.php');
 
$action = $_REQUEST["action"];
$data = $_REQUEST["data"];
$cache = $_REQUEST["dojo.preventCache"];
 
$data = str_replace("\\\"","\"",$data);
 
// instanciation d un json-php
 
$json = new services_JSON();
 
if ( $action == "getChildren") {
$jsonData = $json->decode($data);
// get the node object
$node = $jsonData->node;
}
 
if ( $action == "getChildren") {
$jsonData = $json->decode($data);
// get the node object
$node = $jsonData->node;
// on recupere le noeud parent
$parent = $node->objectId;
if (isset($_REQUEST['id_projet'])) $id_projet = $_REQUEST['id_projet'];
if (preg_match ('/projet_([0-9]+)/', $node->objectId, $match)) $id_projet = $match[1];
// correspondance entre l objectid de dojo et id_parent de projet_document
if ( $parent == "root" || preg_match ('/projet_([0-9]+)/', $node->objectId, $match)) {
$id_parent = 0 ;
} else {
$id_parent = $node->objectId;
}
$sql = 'select * from projet_documents where pd_pere='.$id_parent ;
if (isset($id_projet)) $sql .= ' and pd_ce_projet='.$id_projet.' and pd_visibilite="public"';
$sql .= ' order by pd_nom';
$resultat = $GLOBALS['projet_db']->query($sql);
 
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$nodeArray = array();
$i = 0;
include_once PROJET_CHEMIN_CLASSES.'document.class.php';
if ($GLOBALS['projet_auth']->getAuth() && is_object($this)) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($GLOBALS['projet_db']) ;
$id_u = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $GLOBALS['projet_db']) ;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID), $GLOBALS['projet_db']) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $GLOBALS['projet_db']);
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
} else {
$droits = PROJET_DROIT_AUCUN;
}
// Recuperation de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
while ( $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$document = new document($ligne['pd_id'], $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES);
$GLOBALS['url']->addQueryString('id_projet', $id_projet);
$GLOBALS['url']->addQueryString('id_document', $document->getIdDocument());
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'telechargement');
// json attend de l utf8, en lui fournissant des donnees au format htmlentities,
// ca passe
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($document->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On regarde si l utilisateur a les droits pour deplacer
if ($droits <= PROJET_DROIT_COORDINATEUR ||
$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$actions = 'MOVE,REMOVE,EDIT' ;
if ($document->isRepertoire()) $actions .= ',ADDCHILD';
}
else $actions = '';
$node = array(
'title'=> iconv('ISO-8859-1', 'UTF-8', $document->getNomLong()),
'widgetId' => 'document_'.$document->getIdDocument(),
'objectId'=> $document->getIdDocument(),
'isFolder'=> $document->isRepertoire(),
'link' => str_replace ('&amp;', '&', $GLOBALS['url']->getURL()),
'childIconSrc' => $document->getCheminIcone(),
'expandIcon' => PROJET_CHEMIN_ICONES.'folder-expanded.gif',
'afterLabel' => ' '.$document->getTailleFormatee().' '.iconv('ISO-8859-1', 'UTF-8',$nom_prenom),
);
// On regarde si l utilisateur a les droits pour deplacer
/*
if ($droits <= PROJET_DROIT_COORDINATEUR ||
$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$actions = 'MOVE,REMOVE,EDIT' ;
if ($document->isRepertoire()) $actions .= ',ADDCHILD';
$node['actions'] = $actions;
}
else {
$node['actions'] = '';
}*/
$nodeArray[$i] = $node;
$i++;
unset ($document);
}
if (!is_null($nodeArray)) {
header ('Content-type: json');
print $json->encode($nodeArray);
exit();
}
}
 
 
 
 
 
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: ecouteArbreFichier.php,v 1.3 2008-10-29 15:53:06 alexandre_tb Exp $
/**
* Application projet
*
* Service d ecoute de l arbre du porte document, renvoie les donnees du repertoire demande
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// ATTENTION - le programme suivant doit renvoyer un tableau, meme vide
// sinon l arbre dojo ne fonctionnera pas (ligne 117 $returnArray = array)
 
 
include_once (GEN_CHEMIN_API.'json/JSON.php');
 
$action = $_REQUEST["action"];
$data = $_REQUEST["data"];
$cache = $_REQUEST["dojo.preventCache"];
 
$data = str_replace("\\\"","\"",$data);
 
// instanciation d un json-php
 
$json = new services_JSON();
 
if ( $action == "getChildren") {
$jsonData = $json->decode($data);
// get the node object
$node = $jsonData->node;
}
 
if ( $action == "getChildren") {
$jsonData = $json->decode($data);
// get the node object
$node = $jsonData->node;
// on recupere le noeud parent
$parent = $node->objectId;
if (isset($_REQUEST['id_projet'])) $id_projet = $_REQUEST['id_projet'];
if (preg_match ('/projet_([0-9]+)/', $node->objectId, $match)) $id_projet = $match[1];
// correspondance entre l objectid de dojo et id_parent de projet_document
if ( $parent == "root" || preg_match ('/projet_([0-9]+)/', $node->objectId, $match)) {
$id_parent = 0 ;
} else {
$id_parent = $node->objectId;
}
$sql = 'select * from projet_documents where pd_pere='.$id_parent ;
if (isset($id_projet)) $sql .= ' and pd_ce_projet='.$id_projet.' and pd_visibilite="public"';
$sql .= ' order by pd_nom';
$resultat = $GLOBALS['projet_db']->query($sql);
 
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$nodeArray = array();
$i = 0;
include_once PROJET_CHEMIN_CLASSES.'document.class.php';
if ($GLOBALS['projet_auth']->getAuth() && is_object($this)) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($GLOBALS['projet_db']) ;
$id_u = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $GLOBALS['projet_db']) ;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID), $GLOBALS['projet_db']) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $GLOBALS['projet_db']);
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
} else {
$droits = PROJET_DROIT_AUCUN;
}
// Recuperation de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
while ( $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$document = new document($ligne['pd_id'], $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES);
$GLOBALS['url']->addQueryString('id_projet', $id_projet);
$GLOBALS['url']->addQueryString('id_document', $document->getIdDocument());
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'telechargement');
// json attend de l utf8, en lui fournissant des donnees au format htmlentities,
// ca passe
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($document->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On regarde si l utilisateur a les droits pour deplacer
if ($droits <= PROJET_DROIT_COORDINATEUR ||
$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$actions = 'MOVE,REMOVE,EDIT' ;
if ($document->isRepertoire()) $actions .= ',ADDCHILD';
}
else $actions = '';
$node = array(
'title'=> iconv('ISO-8859-1', 'UTF-8', $document->getNomLong()),
'widgetId' => 'document_'.$document->getIdDocument(),
'objectId'=> $document->getIdDocument(),
'isFolder'=> $document->isRepertoire(),
'link' => str_replace ('&amp;', '&', $GLOBALS['url']->getURL()),
'childIconSrc' => $document->getCheminIcone(),
'expandIcon' => PROJET_CHEMIN_ICONES.'folder-expanded.gif',
'afterLabel' => ' '.$document->getTailleFormatee().' '.iconv('ISO-8859-1', 'UTF-8',$nom_prenom),
);
// On regarde si l utilisateur a les droits pour deplacer
/*
if ($droits <= PROJET_DROIT_COORDINATEUR ||
$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$actions = 'MOVE,REMOVE,EDIT' ;
if ($document->isRepertoire()) $actions .= ',ADDCHILD';
$node['actions'] = $actions;
}
else {
$node['actions'] = '';
}*/
$nodeArray[$i] = $node;
$i++;
unset ($document);
}
if (!is_null($nodeArray)) {
header ('Content-type: json');
print $json->encode($nodeArray);
exit();
}
}
 
 
 
 
 
?>
/trunk/services/serviceDeplacementFichier.php
1,71 → 1,71
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: serviceDeplacementFichier.php,v 1.1 2007-04-19 09:37:50 alexandre_tb Exp $
/**
* Application projet
*
* Service pour deplacer un fichier, recoie l id du fichier a deplacer et l id du repertoire cible
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// effectue le deplacement d un fichier, repond a un appel d arbreDocument.js
 
// On se situe dans la methode run() de projetControleur
 
// L url contient
// id_projet=id_projet&service=serviceDeplacement&enfant=id_du_doc_a_deplacer&parent=id_du_repertoire_cible
 
// $_GET['parent'] peut valoir 'root' auquel cas on remplace par 0, cela signifie
// qu on deplace un fichier vers le repertoire racine du projet
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
 
header ('Content-type:text/json');
if (isset($_GET['enfant'])) {
$document = new document($_GET['enfant'], $this->_db, PROJET_CHEMIN_FICHIER) ;
// On traite le cas où l'on vient de déplacer un fichier
if (isset ($_GET['parent'])) {
if ($_GET['parent'] == 'root') $id_cible = 0 ; else $id_cible = $_GET['parent'];
if (!$document -> deplace ($id_cible, $projet->getNomRepertoire())) {
echo 'echec du déplacement' ;
}
exit() ;
}
}
exit();
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: serviceDeplacementFichier.php,v 1.1 2007-04-19 09:37:50 alexandre_tb Exp $
/**
* Application projet
*
* Service pour deplacer un fichier, recoie l id du fichier a deplacer et l id du repertoire cible
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// effectue le deplacement d un fichier, repond a un appel d arbreDocument.js
 
// On se situe dans la methode run() de projetControleur
 
// L url contient
// id_projet=id_projet&service=serviceDeplacement&enfant=id_du_doc_a_deplacer&parent=id_du_repertoire_cible
 
// $_GET['parent'] peut valoir 'root' auquel cas on remplace par 0, cela signifie
// qu on deplace un fichier vers le repertoire racine du projet
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
 
header ('Content-type:text/json');
if (isset($_GET['enfant'])) {
$document = new document($_GET['enfant'], $this->_db, PROJET_CHEMIN_FICHIER) ;
// On traite le cas où l'on vient de déplacer un fichier
if (isset ($_GET['parent'])) {
if ($_GET['parent'] == 'root') $id_cible = 0 ; else $id_cible = $_GET['parent'];
if (!$document -> deplace ($id_cible, $projet->getNomRepertoire())) {
echo 'echec du déplacement' ;
}
exit() ;
}
}
exit();
?>