示例#1
0
 public function actionLoad()
 {
     Payments::model()->deleteAll();
     Trucks::model()->deleteAll();
     ZReport::model()->deleteAll();
     $this->render("load");
 }
示例#2
0
 public function actionCheckzreport()
 {
     $date = $_GET["date"];
     $zreport = ZReport::model()->findAll("date=:date", array(":date" => $date));
     if ($zreport) {
         CJSON::encode($zreport);
     } else {
         echo "false";
     }
 }
示例#3
0
    echo "Error fetching items\n";
    echo $e->getMessage() . "\n";
    $lastResponse = $library->getLastResponse();
    var_dump($lastResponse);
    echo "Last Response Body: " . $lastResponse->getRawBody() . " \n";
    die("Leaving\n");
}
$library->items->addChildKeys();
$items = array();
foreach ($itemKeys as $key) {
    $item = $library->items->getItem($key);
    if ($item !== false && empty($item->links['up'])) {
        $items[] = $item;
    }
}
$zreport = new ZReport();
$zreport->setLibrary($library);
$zreport->baseUrl = $baseUrl;
$zreport->paginationType = 'query';
//set pagination type so we always use this page
$zreport->headerTemplateFile = $headerTemplateFilePath;
$zreport->postTemplateFile = $postTemplateFilePath;
$zreport->footerTemplateFile = $footerTemplateFilePath;
$p = isset($_GET['p']) ? (int) $_GET['p'] - 1 : 0;
$pages = $zreport->writePages($items);
echo $pages[$p];
//save library
if ($libraryCacheType == 'file') {
    file_put_contents($librarySaveFilePath, serialize($library));
} elseif ($libraryCacheType == 'apc') {
    apc_store('zreportlibrarycache', $library, $ttl);
示例#4
0
    echo "Error fetching items\n";
    echo $e->getMessage() . "\n";
    $lastResponse = $library->getLastResponse();
    var_dump($lastResponse);
    echo "Last Response Body: " . $lastResponse->getRawBody() . " \n";
    die("Leaving\n");
}
$library->items->addChildKeys();
$items = array();
foreach ($itemKeys as $key) {
    $item = $library->items->getItem($key);
    if ($item !== false && empty($item->links['up'])) {
        $items[] = $item;
    }
}
$zreport = new ZReport();
$zreport->setLibrary($library);
$zreport->baseUrl = $baseUrl;
//clear the cache for static generation - the static files are our cache
//apc_clear_cache('user');
//$items = $library->fetchItems(array('collectionKey'=>$reportCollectionKey, 'limit'=>100));
echo "have items: " . count($items) . "\n";
$pages = $zreport->writePages($items);
for ($i = 0; $i < count($pages); $i++) {
    $zreport->savePage($pages[$i], $i + 1);
}
//save library
if ($libraryCacheType == 'file') {
    file_put_contents($librarySaveFilePath, serialize($library));
} elseif ($libraryCacheType == 'apc') {
    apc_store('zreportlibrarycache', $library);
 public function actionIndex()
 {
     $zreports = ZReport::model()->findAll(array("order" => "date"));
     $this->render('index', array("zreports" => $zreports));
 }