Added update_year.sh (still not fully flexible) and updated all years with it.
[mailer.git] / inc / extensions / grade / mode-setup.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 11/24/2009 *
4  * ===================                          Last change: 11/24/2009 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-grade.php                                    *
8  * -------------------------------------------------------------------- *
9  * Short description : Grades for your members                          *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Accountstufen Ihrer Mitglieder                   *
12  * -------------------------------------------------------------------- *
13  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
14  * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
15  * For more information visit: http://mxchange.org                      *
16  *                                                                      *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or    *
20  * (at your option) any later version.                                  *
21  *                                                                      *
22  * This program is distributed in the hope that it will be useful,      *
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
25  * GNU General Public License for more details.                         *
26  *                                                                      *
27  * You should have received a copy of the GNU General Public License    *
28  * along with this program; if not, write to the Free Software          *
29  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
30  * MA  02110-1301  USA                                                  *
31  ************************************************************************/
32
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
35         die();
36 } // END - if
37
38 // @TODO Remove double tabs from all lines
39                 // General and grade level data
40                 addDropTableSql('grade_data');
41                 addCreateTableSql('grade_data', "
42 `grade_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
43 `grade_name` VARCHAR(255) NOT NULL DEFAULT '',
44 `grade_description` TINYTEXT NOT NULL,
45 `grade_parent_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
46 UNIQUE INDEX (`grade_name`),
47 INDEX (`grade_parent_id`),
48 PRIMARY KEY (`grade_id`)",
49                         'Grade data');
50
51                 // Data for if a grade level has been reached
52                 addDropTableSql('grade_cash_data');
53                 addCreateTableSql('grade_cash_data', "
54 `cash_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
55 `grade_cash_name` VARCHAR(255) NOT NULL DEFAULT '',
56 `grade_cash_type` ENUM('DISCOUNT','BONUS') NOT NULL DEFAULT 'DISCOUNT',
57 `reached_points` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL,
58 `reached_mails` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
59 `time_valid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
60 UNIQUE INDEX (`grade_cash_name`),
61 PRIMARY KEY (`cash_id`)",
62                         'Data for "cashed" grades');
63
64                 // Connection grade<->cash data
65                 addDropTableSql('grade_cash_connect');
66                 addCreateTableSql('grade_cash_connect', "
67 `connect_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
68 `grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
69 `grade_cash_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
70 UNIQUE INDEX `grade_cash` (`grade_id`, `grade_cash_id`),
71 INDEX (`grade_cash_id`),
72 PRIMARY KEY (`connect_id`)",
73                         'Grade<->cash data connection');
74
75                 // Connection grade<->user data
76                 addDropTableSql('grade_user_connect');
77                 addCreateTableSql('grade_user_connect', "
78 `connect_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
79 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
80 `grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
81 `grade_expired` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
82 UNIQUE INDEX (`userid`, `grade_id`),
83 INDEX (`grade_id`),
84 PRIMARY KEY (`connect_id`)",
85                         'Grade<->user connection');
86
87                 // Add example grade
88                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_grade_data` (`grade_name`,`grade_description`) VALUES ('Metall','Einfache Metallstufe.')");
89                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_grade_cash_data` (`grade_cash_name`,`grade_cash_type`,`reached_points`) VALUES('Metallbonus','BONUS',1000)");
90                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_grade_cash_connect` (`grade_id`,`grade_cash_id`) VALUES (1,1)");
91
92                 // Admin menu entries
93                 addAdminMenuSql('grade', NULL, 'Accountstufen', 'Stufen Sie Ihre Mitglieder ein, die sie ab einer einstellbaren Anzahl an {OPEN_CONFIG}POINTS{CLOSE_CONFIG} oder best&auml;tigten Mails usw. erhalten und durch die Accountstufe Erm&auml;&szlig;igungen oder Sonderboni erhalten k&ouml;nnen.', 6);
94                 addAdminMenuSql('grade', 'list_grade_data', 'Auflisten...', 'Listet alle Accountstufen auf, auch sind diese hier editierbar, neue hinzuf&uuml;gbar und l&ouml;schbar.', 1);
95                 addAdminMenuSql('grade', 'list_cash_grade', 'Erm&auml;&szlig;igungen/Sonderboni', 'Listet alle Erm&auml;&szlig;igungen/Sonderboni auf, auch sind diese hier editierbar, neue hinzuf&uuml;gbar und l&ouml;schbar.', 2);
96                 addAdminMenuSql('grade', 'list_current_grades', 'Mitgliedaccountsstufen', 'Liste alle durch die Mitglieder aktuell erreichten Einstungen auf. Diese sind nicht editierbar (wir wollen ja nicht schummeln und bestimmten Mitgliedern bessere Accountstufen geben, oder? ;-) ).', 3);
97                 addAdminMenuSql('grade', 'config_grade', 'Einstellungen ...', 'Diverse Einstellungen zu den Accountstufen.', 4);
98
99                 // Member menu
100                 addMemberMenuSql('account', 'grade', 'Erreichte Stufe', 2);
101
102                 // Guest menu
103                 addGuestMenuSql('members', 'grade', 'Accountstufen', 4);
104
105 // [EOF]
106 ?>