function __construct($create_tables = false)
 {
     $this->create_tables = $create_tables;
     // use another table prefix?
     if (file_exists(WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json')) {
         $config = json_decode(file_get_contents(WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json'), true);
         if (isset($config['table_prefix'])) {
             self::$table_prefix = $config['table_prefix'];
         }
     }
     parent::__construct();
     $this->setTablePrefix(self::$table_prefix);
     $this->setTableName('mod_kit_newsletter_template');
     $this->addFieldDefinition(self::field_id, "INT NOT NULL AUTO_INCREMENT", true);
     $this->addFieldDefinition(self::field_name, "VARCHAR(255) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_description, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_html, "TEXT NOT NULL DEFAULT ''", false, false, true);
     $this->addFieldDefinition(self::field_text, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_status, "VARCHAR(30) NOT NULL DEFAULT '" . self::status_active . "'");
     $this->addFieldDefinition(self::field_update_by, "VARCHAR(30) NOT NULL DEFAULT 'SYSTEM'");
     $this->addFieldDefinition(self::field_update_when, "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
     // check field definitions
     $this->checkFieldDefinitions();
     // create tables
     if ($this->create_tables) {
         if (!$this->sqlTableExists()) {
             if (!$this->sqlCreateTable()) {
                 $this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $this->getError()));
                 return false;
             }
         }
     }
     return true;
 }
Ejemplo n.º 2
0
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITcontactAddress->getError());
}
$dbKITprovider = new dbKITprovider(true);
if ($dbKITprovider->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITprovider->getError());
}
$dbKITmail = new dbKITmail(true);
if ($dbKITmail->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITmail->getError());
}
$dbKITregister = new dbKITregister(true);
if ($dbKITregister->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITregister->getError());
}
// Install tables for newsletter module
$dbKITnewsletterTemplates = new dbKITnewsletterTemplates(true);
if ($dbKITnewsletterTemplates->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterTemplates->getError());
}
$dbKITnewsletterPreview = new dbKITnewsletterPreview(true);
if ($dbKITnewsletterPreview->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterPreview->getError());
}
$dbKITnewsletterCfg = new dbKITnewsletterCfg(true);
if ($dbKITnewsletterCfg->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterCfg->getError());
}
$dbKITnewsletterArchive = new dbKITnewsletterArchive(true);
if ($dbKITnewsletterArchive->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterArchive->getError());
}
Ejemplo n.º 3
0
    }
}
$dbKITcontact = new dbKITcontact();
if (!$dbKITcontact->sqlFieldExists(dbKITcontact::field_newsletter)) {
    if (!$dbKITcontact->sqlAlterTableAddField(dbKITcontact::field_newsletter, "VARCHAR (255) NOT NULL DEFAULT ''", dbKITcontact::field_category)) {
        $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITcontact->getError());
    }
}
// check field_distribution --> #0.29
if (!$dbKITcontact->sqlFieldExists(dbKITcontact::field_distribution)) {
    if (!$dbKITcontact->sqlAlterTableAddField(dbKITcontact::field_distribution, "VARCHAR(255) NOT NULL DEFAULT ''", dbKITcontact::field_newsletter)) {
        $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITcontact->getError());
    }
}
// install tables for newsletter module
$dbKITnewsletterTemplates = new dbKITnewsletterTemplates();
if (!$dbKITnewsletterTemplates->sqlTableExists()) {
    if (!$dbKITnewsletterTemplates->sqlCreateTable()) {
        $error .= sprintf('<p>[Upgrade] %s</p>', $dbKITnewsletterTemplates->getError());
    }
}
$dbKITnewsletterPreview = new dbKITnewsletterPreview();
if (!$dbKITnewsletterPreview->sqlTableExists()) {
    if (!$dbKITnewsletterPreview->sqlCreateTable()) {
        $error .= sprintf('<p>[Upgrade] %s</p>', $dbKITnewsletterPreview->getError());
    }
}
$dbKITnewsletterCfg = new dbKITnewsletterCfg();
if (!$dbKITnewsletterCfg->sqlTableExists()) {
    if (!$dbKITnewsletterCfg->sqlCreateTable()) {
        $error .= sprintf('<p>[Upgrade] %s</p>', $dbKITnewsletterCfg->getError());