]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-grade.php
Inactive developer 'profi-concept' moved to inactive section
[mailer.git] / inc / extensions / ext-grade.php
index 124a9abbdbf591fc72ef0bdc3c126642a9a12cb9..a798c5b38b4ad5b4e6ef51119ad3b6673c5fc22f 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -42,18 +41,68 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.0');
+setThisExtensionVersion('0.0.0');
 
-// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0'));
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0'));
+
+// This extension is in development (non-productive)
+enableExtensionProductive(false);
 
 switch (getExtensionMode()) {
-       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
-               // SQL commands to run
+       case 'register': // Do stuff when installation is running
+               // General and grade level data
+               addDropTableSql('grade_data');
+               addCreateTableSql('grade_data', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`grade_name` VARCHAR(255) NOT NULL DEFAULT '',
+`grade_parent_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+INDEX (`grade_parent_id`)
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade general data'");
+
+               // Data for if a grade level has been reached
+               addDropTableSql('grade_cash_data');
+               addCreateTableSql('grade_cash_data', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`grade_cash_name` VARCHAR(255) NOT NULL DEFAULT '',
+`grade_cash_type` ENUM('DISCOUNT','BONUS') NOT NULL DEFAULT 'DISCOUNT',
+`reached_points` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL,
+`reached_mails` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
+`time_valid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+PRIMARY KEY (`id`),
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade data if the grade have been \"cashed\"'");
+
+               // Connection grade<->cash data
+               addDropTableSql('grade_cash_connect');
+               addCreateTableSql('grade_cash_conenct', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`grade_cash_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+PRIMARY KEY (`id`),
+UNIQUE KEY `grade_cash` (`grade_id`,`grade_cash_id`),
+INDEX (`grade_cash_id`)
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade<->cash data connection'");
+
+               // Connection grade<->user data
+               addDropTableSql('grade_user_connect');
+               addCreateTableSql('grade_user_connect', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`grade_expired TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY (`id`),
+UNIQUE KEY (`userid`,`grade_id`),
+INDEX (`grade_id`)
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade<->user connection'");
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
+               addDropTableSql('grade_data');
+               addDropTableSql('grade_cash_data');
+               addDropTableSql('grade_cash_connect');
+               addDropTableSql('grade_user_connect');
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -78,14 +127,14 @@ switch (getExtensionMode()) {
        case 'modify': // When the extension got modified
                break;
 
-       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+       case 'test': // For testing purposes
                break;
 
        case 'init': // Do stuff when extension is initialized
                break;
 
        default: // Unknown extension mode
-               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
 } // END - switch