Beispiel #1
0
 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";
     }
 }
Beispiel #2
0
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;
}
Beispiel #3
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);
     }
 }