continue my work
authorx2000habouzit <x2000habouzit>
Fri, 15 Oct 2004 15:39:40 +0000 (15:39 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 15 Oct 2004 15:39:40 +0000 (15:39 +0000)
include/newsletter.inc.php
scripts/migration/0.9.1/newsleter.sql

index 3778bca..654fa25 100644 (file)
@@ -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 {
index 19cce45..9cdddcb 100644 (file)
@@ -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)
+);
+-- -----------------------------------------------------------------------------