--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program 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 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************
+ $Id: newsletter_cats.php,v 1.1 2004-10-15 14:30:53 x2000habouzit Exp $
+ ***************************************************************************/
+
+require('auto.prepend.inc.php');
+new_admin_table_editor('newsletter_cat','cid');
+
+$editor->describe('titre','intitulé',true);
+$editor->describe('pos','position',true);
+
+$editor->assign('title', 'Gestion des catégories de la newsletter');
+
+$editor->run();
+?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: newsletter.inc.php,v 1.2 2004-10-15 12:57:10 x2000habouzit Exp $
+ $Id: newsletter.inc.php,v 1.3 2004-10-15 14:30:54 x2000habouzit Exp $
***************************************************************************/
+
+define('FEMME', 1);
+define('HOMME', 0);
+
class NewsLetter {
function NewsLetter() { }
}
+class NLArticle {
+ function NLArticle() { }
+}
+
+class NLConstraint {
+ var $_func;
+ var $_arg;
+
+ function NLConstraint($func, $arg) {
+ $this->_func = $func;
+ $this->_arg = $arg;
+ }
+
+ function check($user) { return false; }
+}
+
+class NLPromoConstraint {
+ function check($user) {
+ $promo = $user['promo'];
+ switch($this->_func) {
+ case 'eq': return ( $promo == $this->_arg );
+ case 'neq': return ( $promo != $this->_arg );
+ case 'geq': return ( $promo >= $this->_arg );
+ case 'leq': return ( $promo <= $this->_arg );
+ case 'odd': return ( $promo % 2 == 1 );
+ case 'even': return ( $promo % 2 == 0 );
+ default: return false;
+ }
+ }
+}
+
+class NLSexeConstraint {
+ function check($user) { return $user['sexe'] == $_arg; }
+}
+
+
function get_nl_list() {
global $globals;
$res = $globals->db->query("SELECT id,date,titre FROM newsletter ORDER BY date DESC");
function subscribe_nl() {
global $globals;
- $globals->db->query("INSERT INTO newsletter_ins (user_id) VALUES ({$_SESSION['uid']})");
+ $globals->db->query("REPLACE INTO newsletter_ins (user_id,last) SELECT {$_SESSION['uid']}, MAX(id) FROM newsletter WHERE bits!='new'");
}
?>
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;
+update newsletter set bits='old';
alter table newsletter_ins add column last int;
alter table newsletter_ins add index (last);
+
+create table newsletter_cat (
+ cid tinyint unsigned not null auto_increment,
+ pos tinyint unsigned not null,
+ titre varchar(128) not null,
+ PRIMARY KEY (cid),
+ INDEX (pos)
+);
+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');
+
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: index.tpl,v 1.8 2004-10-08 12:04:05 x2000habouzit Exp $
+ $Id: index.tpl,v 1.9 2004-10-15 14:30:55 x2000habouzit Exp $
***************************************************************************}
</td></tr>
<tr class="pair"><td>
<strong>Newsletter : </strong>
+ <a href="newsletter_cats.php">Catégories</a> |
<a href="newsletter_prep.php">Préparation</a> |
<a href="newsletter_archi.php">Archives</a> |
<a href="newsletter_pattecassee.php">Adresses en panne</a>