示例#1
0
文件: email.php 项目: nicolaisi/adei
 function createPNG($props)
 {
     try {
         $req = new DATARequest();
         $fullpath = $ADEI_ROOTDIR . "tmp/tmpimg/";
         //$fullpath .= $pic;
         $picname;
         foreach ($props as $key => $value) {
             $req->SetProp($key, $value);
             if ($key == 'db_server' || $key == 'db_name' || $key == 'window') {
                 $picname .= $value . "-";
             }
         }
         $picname .= rand(1, 200);
         $picname .= ".png";
         $fullpath .= $picname;
         $draw = $req->CreatePlotter();
         $draw->Create();
         $draw->Save($fullpath);
         return $fullpath;
     } catch (ADEIException $ex) {
         $ex->logInfo(NULL, $draw);
         return "FAILED";
     }
 }
示例#2
0
文件: image.php 项目: nicolaisi/adei
 function End($flags = 0)
 {
     try {
         $req = new DATARequest();
         $draw = $req->CreatePlotter();
         $draw->Create();
         $id = $draw->Save();
     } catch (ADEIException $e) {
         $error = $e->getInfo();
         try {
             if (!$draw) {
                 if (!$req) {
                     $req = new REQUEST();
                 }
                 $draw = $req->CreateTextPlotter();
             }
             //	    $draw->CreateMessage("Error", "No Data");
             $draw->CreateMessage("Error", $error);
             $id = $draw->Save();
             $error = false;
         } catch (ADEIException $ex) {
             $ex->logInfo(NULL, $draw);
         }
     }
     $res = DRAW::Display($id);
     $this->h->Write($res);
 }
示例#3
0
文件: update.php 项目: nicolaisi/adei
function TryPlot(DATARequest $req, &$draw, &$no_data)
{
    try {
        $draw = $req->CreatePlotter();
        $draw->Create();
    } catch (ADEIException $ae) {
        $recovered = false;
        switch ($ae->getCode()) {
            case ADEIException::PLOTTER_WINDOW_TOO_SMALL:
                if (!$req->GetProp('hide_axes')) {
                    $ae->logInfo(NULL, $draw ? $draw : $req);
                    $req->SetProp('hide_axes', 'Y');
                    TryPlot($req, $draw, $no_data);
                    return translate("To many Y-axes, hidden");
                }
                break;
            case ADEIException::NO_DATA:
            case ADEIException::NO_CACHE:
            case ADEIException::INVALID_REQUEST:
                if ($draw) {
                    try {
                        $error = $ae->getInfo();
                        $draw->CreateMessage("Error", $error);
                        $no_data = true;
                        return 0;
                    } catch (ADEIException $ex) {
                        $ex->logInfo(NULL, $draw);
                        throw $ae;
                    }
                }
                break;
        }
        throw $ae;
    }
    return 0;
}
示例#4
0
 function GetCacheImg($download)
 {
     $filename = $this->downloads_path . "/images/{$download}.png";
     try {
         $req = new DATARequest();
         $req->SetProp("width", "512");
         $req->SetProp("height", "384");
         $draw = $req->CreatePlotter();
         $draw->Create();
         $draw->Save($filename);
     } catch (ADEIException $ex) {
         $ex->logInfo(NULL, $draw);
     }
 }
示例#5
0
<?php

ADEI::RequireClass("draw");
header("Content-type: image/png");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
if (isset($_GET["id"])) {
    $id = $_GET["id"];
} else {
    try {
        $req = new DATARequest();
        $draw = $req->CreatePlotter();
        $draw->Create();
        $id = $draw->Save();
    } catch (ADEIException $e) {
        $error = $e->getInfo();
        try {
            if (!$draw) {
                if (!$req) {
                    $req = new REQUEST();
                }
                $draw = $req->CreateTextPlotter();
            }
            //	    $draw->CreateMessage("Error", "No Data");
            $draw->CreateMessage("Error", $error);
            $id = $draw->Save();
            $error = false;
        } catch (ADEIException $ex) {
            $ex->logInfo(NULL, $draw);
        }
    }