Example #1
0
<?php

# init
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', './');
$_mage_file = MAGENTO_ROOT . 'app/Mage.php';
require_once $_mage_file;
Mage::app();
date_default_timezone_set('Asia/Hong_Kong');
require_once './vendor/autoload.php';
use Ulrichsg\Getopt;
$getopt = new Getopt(array(array(null, 'store', Getopt::REQUIRED_ARGUMENT, 'Store ID'), array(null, 'csv', Getopt::OPTIONAL_ARGUMENT, 'Update File'), array(null, 'images', Getopt::OPTIONAL_ARGUMENT, 'Image Folder')));
$getopt->parse();
$_store_id = $getopt->getOption('store');
if (isset($_store_id) === false) {
    $getopt->showHelp();
    die;
}
// $_show_help = $getopt->getOption('help');
// if (isset($_show_help) === true) {
//   $getopt->showHelp();
//   die();
// }
// get website id
$_store = Mage::app()->getStore($_store_id);
$_website_id = $_store->getData('website_id');
$_csv = $getopt->getOption('csv');
if (isset($_csv) === false) {
    $getopt->showHelp();
    die;
}
Example #2
0
<?php

# init
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', './');
$_mage_file = MAGENTO_ROOT . '/app/Mage.php';
require_once $_mage_file;
Mage::app();
date_default_timezone_set('Asia/Hong_Kong');
require_once './vendor/autoload.php';
use Ulrichsg\Getopt;
$getopt = new Getopt(array(array(null, 'store', Getopt::REQUIRED_ARGUMENT, 'Store ID'), array(null, 'csv', Getopt::OPTIONAL_ARGUMENT, 'Update File'), array(null, 'help', Getopt::OPTIONAL_ARGUMENT, 'Help')));
$getopt->parse();
$_store_id = $getopt->getOption('store');
if (isset($_store_id) === false) {
    $getopt->showHelp();
    die;
}
$_show_help = $getopt->getOption('help');
if (isset($_show_help) === true) {
    $_root_id = Mage::app()->getStore($_store_id)->getRootCategoryId();
    $_category = Mage::getModel('catalog/category')->setStoreId($_store_id)->load($_root_id);
    $_data = $_category->getData();
    echo 'Available Fileds: ' . PHP_EOL;
    foreach ($_data as $_key => $_value) {
        echo $_key . PHP_EOL;
    }
    $getopt->showHelp();
    die;
}
$_csv = $getopt->getOption('csv');
Example #3
0
 * @file
 * @version 0.1
 * @copyright 2016 CN-Consult GmbH
 * @author Max Späth <*****@*****.**>
 */
require_once "lib/gamefieldcontroller.php";
require_once "lib/gamefield.php";
include_once "lib/external/vendor/autoload.php";
foreach (glob('lib/output/*.php') as $file) {
    include $file;
}
foreach (glob('lib/input/*.php') as $file) {
    include $file;
}
use Ulrichsg\Getopt;
$options = new Getopt(array(array('i', 'input', Getopt::REQUIRED_ARGUMENT, 'Specifys how the start gamefield should be read, "txt" for reading from txt file'), array('f', 'filepath', Getopt::OPTIONAL_ARGUMENT, 'Path to txt file(only required if txt is choosen as input'), array('o', 'output', Getopt::REQUIRED_ARGUMENT, '"console" for console output, "png" for output as png file, "gif" for output as .gif file.'), array('c', 'numCycles', Getopt::REQUIRED_ARGUMENT, 'Number of rounds the game should play 1-*'), array('h', 'help', Getopt::NO_ARGUMENT)));
$options->parse();
if ($options->getOption("help")) {
    $options->showHelp();
} else {
    if ($options->getOption('input')) {
        $config = array();
        if ($options->getOption("filepath")) {
            $config['filePath'] = $options->getOption('filepath');
        }
        $inputClass = $options->getOption("input") . "Input";
        $input = new $inputClass($config);
        $outputClass = $options->getOption("output") . "Output";
        if ($options->getOption("numCycles")) {
            $numCycles = $options->getOption('numCycles');
            if ($options->getOption("output")) {