function genere_bulletin($perio_info, $bull_info, $isbull = true) { global $bl, $hl, $notice_id; //on récup et/ou génère le pério $perio_id = genere_perio($perio_info); //on s'occupe du cas ou on a pas de titre pour le bulletin $search = "select bulletin_id from bulletins where date_date = '" . $bull_info['date'] . "' and bulletin_numero LIKE '" . $bull_info['num'] . "' and bulletin_notice = {$perio_id}"; $res = pmb_mysql_query($search); if (pmb_mysql_num_rows($res) == 0) { if ($bull_info['mention'] == "") { $bull_info['mention'] = substr($bull_info['date'], 8, 2) . "/" . substr($bull_info['date'], 5, 2) . "/" . substr($bull_info['date'], 0, 4); } $insert = "insert into bulletins set date_date = '" . $bull_info['date'] . "', mention_date = '" . $bull_info['mention'] . "', bulletin_numero = '" . $bull_info['num'] . "', bulletin_notice = {$perio_id}"; if ($bl == "s" && $hl == "2") { $insert .= ", num_notice = {$notice_id}"; update_notice("b", "2"); } $result = pmb_mysql_query($insert); $bull_id = pmb_mysql_insert_id(); } else { $bull_id = pmb_mysql_result($res, 0, 0); } return $bull_id; }
function genere_bulletin($perio_info, $bull_info, $isbull = true) { global $bl, $hl, $notice_id; //on récup et/ou génère le pério $perio_id = genere_perio($perio_info); //on s'occupe du cas ou on a pas de titre pour le bulletin // num (mention) [date] if ($bull_info['titre'] == "") { $bull_info['titre'] = $bull_info['num'] . ($bull_info['mention'] ? " (" . $bull_info['mention'] . ") " : " ") . ($bull_info['date'] ? "[" . $bull_info['date'] . "]" : ""); } $search = "select bulletin_id from bulletins where bulletin_titre LIKE '" . addslashes($bull_info['titre']) . "' and mention_date LIKE '" . $bull_info['mention'] . "' and bulletin_numero LIKE '" . $bull_info['num'] . "' and bulletin_notice = {$perio_id}"; $res = mysql_query($search); if (mysql_num_rows($res) == 0) { $insert = "insert into bulletins set bulletin_titre = '" . $bull_info['titre'] . "', date_date = '" . $bull_info['date'] . "', mention_date = '" . $bull_info['mention'] . "', bulletin_numero = '" . $bull_info['num'] . "', bulletin_notice = {$perio_id}"; if ($bl == "s" && $hl == "2") { $insert .= ", num_notice = {$notice_id}"; update_notice("b", "2"); } $result = mysql_query($insert); $bull_id = mysql_insert_id(); } else { $bull_id = mysql_result($res, 0, 0); //on regarde si une notice n'existe pas déjà pour ce bulletin $req = "select num_notice from bulletins where bulletin_id = {$bull_id} and num_notice != 0"; $res = mysql_query($req); //si oui on retire l'enregistrement en cours, et on continue sur la notice existante... if (mysql_num_rows($res) > 0) { notice::del_notice($notice_id); $notice_id = mysql_result($res, 0, 0); } } return $bull_id; }
function notice_to_article($perio_info, $bull_info) { global $notice_id; $bull_id = genere_bulletin($perio_info, $bull_info); update_notice("a", "2"); $insert = "insert into analysis set analysis_bulletin = {$bull_id}, analysis_notice = {$notice_id}"; pmb_mysql_query($insert); }
<?php // +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: fiche_ajax.inc.php,v 1.1 2010-06-21 09:11:16 ngantier Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once "{$class_path}/fiche.class.php"; switch ($quoifaire) { case 'show_fiche': show_fiche($idfiche); break; case 'update': update_notice($idfiche); break; } function show_fiche($idfiche) { global $liste_ids; $fic = new fiche($idfiche); $fic->liste_ids = explode(",", $liste_ids); ajax_http_send_response($fic->show_fiche_form()); } function update_notice($idfiche) { $fic = new fiche($idfiche); ajax_http_send_response($fic->show_edit_form()); }