88 lines
1.7 KiB
PHP
Executable File
88 lines
1.7 KiB
PHP
Executable File
#!/usr/bin/php
|
|
<?php
|
|
|
|
//require 'vendor/autoload.php';
|
|
require("../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
|
|
|
|
$request=array();
|
|
|
|
// Put commandline arguments into $request
|
|
if(count($argv)) {
|
|
$args=$argv;
|
|
array_shift($args); // shift scriptname off of args array
|
|
|
|
foreach($args as $i => $arg) {
|
|
if(preg_match('/^--([^ ]+)/',$arg,$m)) {
|
|
if(!preg_match('/^--/',$args[$i+1])) {
|
|
$request[$m[1]]=$args[$i+1];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if(!$request['user_id']) {
|
|
die("User id missing");
|
|
}
|
|
|
|
$me = new User($request['user_id']);
|
|
mfValuecache::singleton()->set("me", $me);
|
|
|
|
//var_dump($request);exit;
|
|
|
|
|
|
if(array_key_exists("uid", $request)) {
|
|
if($request['uid']) {
|
|
$uid = $request['uid'];
|
|
unset($request['uid']);
|
|
}
|
|
} else {
|
|
die("uid missing\n");
|
|
}
|
|
|
|
|
|
$filter = [];
|
|
|
|
$type = false;
|
|
|
|
foreach($request as $key => $value) {
|
|
if($key == "user_id") continue;
|
|
if($key == "type") {
|
|
$type = $value;
|
|
continue;
|
|
}
|
|
if(strlen($value)) {
|
|
$filter[$key] = $value;
|
|
} else {
|
|
if($key == "status_id" || $key == "network_id" || $key == "networksection_id") {
|
|
$filter[$key] = "";
|
|
}
|
|
}
|
|
}
|
|
|
|
$params = ['export_progress' => 1, 'uid' => $uid, 'filter' => $filter];
|
|
|
|
//var_dump($uid, $filter);exit;
|
|
|
|
$Layout = Layout::singleton();
|
|
|
|
if($type == "Linework") {
|
|
$app = new LineworkController();
|
|
$app->startExport($params);
|
|
}
|
|
|
|
if($type == "Pipework") {
|
|
$app = new PipeworkController();
|
|
$app->startExport($params);
|
|
}
|
|
|
|
$Layout->display(); |