예제 #1
0
/*
//$_POST['date1']='2015-01-01';
//$_POST['date2']='2015-02-01';
//$_POST['type_id']='4';
//$_POST['user_id']='14';
*/
if (!(isset($_POST['date1']) && isset($_POST['user_id']))) {
    echo "<p style=\"text-align:center;padding-top:45vh;color:#ee0000;font-size:2em\">ไม่สามารถแสดงรายงานออกมาได้</p>";
    exit;
}
$dir = __DIR__ . '/';
require_once $dir . '../rest/NotORM/lib.php';
require_once $dir . '../rest/Twig/Autoloader.php';
Twig_Autoloader::register();
$orm = NotORM::getInstance();
$loader = new Twig_Loader_Filesystem($dir . '/templates/');
$twig = new Twig_Environment($loader, array('__cache' => $dir . '/cache/'));
require_once $dir . 'filters.php';
$lookups = $orm->at()->fetchPairs('id', 'name');
$filter = new Twig_SimpleFilter('lookup_at', function ($id) use($lookups) {
    if (isset($lookups[$id])) {
        return $lookups[$id];
    }
    return '';
});
$twig->addFilter($filter);
$date1 = '';
$date2 = '';
$user_id = '';
$type_id = null;
예제 #2
0
 public function __construct(array $userSettings = array())
 {
     parent::__construct($userSettings);
     $this->container->singleton('user', function ($c) {
         return new WebUser();
     });
     $this->container->singleton('orm', function ($c) {
         require_once __DIR__ . '/../venders/NotORM/lib.php';
         return NotORM::getInstance();
     });
     $this->container->singleton('session', function ($c) {
         return new WebSession();
     });
 }
예제 #3
0
파일: api.php 프로젝트: aodkrisda/mayotin
 public function __construct(array $userSettings = array())
 {
     parent::__construct($userSettings);
     $this->container->singleton('auth', function ($c) {
         return new AppUser();
     });
     $this->container->singleton('orm', function ($c) {
         return NotORM::getInstance();
     });
     $this->container->singleton('session', function ($c) {
         return new Session();
     });
 }