コード例 #1
0
<?php

/**
 * @package uicmpgenerator
 * @subpackage processors
 */
$modx->lexicon->load('uicmpgenerator:default');
if (empty($scriptProperties['id'])) {
    return $modx->error->failure($modx->lexicon('uicmpgenerator.err_nf'));
}
$cmp = $modx->getObject('Uicmpgenerator', $scriptProperties['id']);
if (empty($cmp)) {
    return $modx->error->failure($modx->lexicon('uicmpgenerator.err_nf'));
}
require_once MODX_CORE_PATH . 'components/uicmpgenerator/model/uicmpgenerator/uicmpg.class.php';
$uicmpg = new Uicmpg($this->modx);
$uicmpg->createPackageDirectories($cmp->package);
$manager = $modx->getManager();
$loaded = (include_once MODX_CORE_PATH . 'components/uicmpgenerator/model/uicmpgenerator/' . $modx->config['dbtype'] . '/dbhelper.class.php');
if ($loaded) {
    $generatorClass = 'Dbhelper_' . $modx->config['dbtype'];
    $generator = new $generatorClass($manager);
    $dbname = $cmp->database;
    $generator->setDatabase($dbname);
    $table_prefix = $cmp->table_prefix;
    if (!empty($dbname) && empty($table_prefix)) {
        $restrict_prefix = false;
    }
}
$directories = $uicmpg->getPackageDirectories($cmp->package);
$xml_schema_file = $directories['my_model'] . $cmp->package . '.mysql.schema.xml';
コード例 #2
0
ファイル: build.php プロジェクト: Piterden/modx_testfloor
}*/
if (empty($scriptProperties['table_prefix'])) {
    $scriptProperties['table_prefix'] = $modx->getOption(xPDO::OPT_TABLE_PREFIX);
}
if ($modx->error->hasError()) {
    return $modx->error->failure();
}
$package_name = $scriptProperties['package'];
if (empty($scriptProperties['id']) || $scriptProperties['id'] < 1) {
    // create
    $cmp = $modx->newObject('Uicmpgenerator');
    $scriptProperties['create_date'] = strftime('%Y-%m-%d %H:%M:%S');
} else {
    // it exists
    $cmp = $modx->getObject('Uicmpgenerator', $scriptProperties['id']);
    unset($scriptProperties['create_date']);
    unset($scriptProperties['last_ran']);
}
//$scriptProperties['last_ran'] = strftime('%Y-%m-%d %H:%M:%S');
if (!is_object($cmp)) {
    return $modx->error->failure('Not an object id: ' . $scriptProperties['id']);
}
$cmp->fromArray($scriptProperties);
/* save */
if ($cmp->save() == false) {
    return $modx->error->failure($modx->lexicon('uicmpgenerator.err_save') . ' ID: ' . $scriptProperties['id']);
}
require_once MODX_CORE_PATH . 'components/uicmpgenerator/model/uicmpgenerator/uicmpg.class.php';
$uicmpg = new Uicmpg($this->modx);
$uicmpg->createPackageDirectories($package_name);
return $modx->error->success('', $cmp);