From c4dfdf2102c1acb338833b944c46e1495dbb88e1 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Fri, 15 Oct 2004 15:39:40 +0000 Subject: [PATCH] continue my work --- include/newsletter.inc.php | 16 ++++++++++++++-- scripts/migration/0.9.1/newsleter.sql | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 3778bca..654fa25 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: newsletter.inc.php,v 1.3 2004-10-15 14:30:54 x2000habouzit Exp $ + $Id: newsletter.inc.php,v 1.4 2004-10-15 15:39:40 x2000habouzit Exp $ ***************************************************************************/ @@ -26,7 +26,19 @@ define('FEMME', 1); define('HOMME', 0); class NewsLetter { - function NewsLetter() { } + $_cats; + + function NewsLetter() { + global $globals; + + $res = $globals->db->query("SELECT cid,title FROM newsletter_cat ORDER BY pos"); + $this->_cats = Array(); + while(list($cid,$title) = mysql_fetch_row($res)) { + $this->_cats[$cid] = $title; + } + mysql_free_result($res) + + } } class NLArticle { diff --git a/scripts/migration/0.9.1/newsleter.sql b/scripts/migration/0.9.1/newsleter.sql index 19cce45..9cdddcb 100644 --- a/scripts/migration/0.9.1/newsleter.sql +++ b/scripts/migration/0.9.1/newsleter.sql @@ -1,3 +1,6 @@ +-- ----------------------------------------------------------------------------- +-- update old table +-- alter table newsletter change id id int not null; alter table newsletter change `date` `date` date not null; alter table newsletter add column bits enum('old','sent','new') default 'new' not null; @@ -5,7 +8,10 @@ update newsletter set bits='old'; alter table newsletter_ins add column last int; alter table newsletter_ins add index (last); - +-- +-- ----------------------------------------------------------------------------- +-- newsletter categories +-- create table newsletter_cat ( cid tinyint unsigned not null auto_increment, pos tinyint unsigned not null, @@ -17,4 +23,28 @@ insert into newsletter_cat values(1,1,'Flash Info'); insert into newsletter_cat values(2,2,'Communications institutionnelles'); insert into newsletter_cat values(3,3,'Groupes X'); insert into newsletter_cat values(4,4,'Activités polytechniciennes'); - +-- +-- ----------------------------------------------------------------------------- +-- newsletter articles +-- +create table newsletter_art ( + id int unsigned not null, + aid smallint unsigned not null, + cid smallint unsigned not null, + pos tinyint unsigned not null, + texte mediumtext not null, + PRIMARY KEY (id,aid) +); +-- +-- ----------------------------------------------------------------------------- +-- newsletter appends +-- +create table newsletter_contact ( + id int unsigned not null, + aid smallint unsigned not null, + titre varchar(128) not null, + content varchar(128) not null, + type enum('url','mail','text','none'), + PRIMARY KEY (id,aid) +); +-- ----------------------------------------------------------------------------- -- 2.1.4