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