Exemple #1
0
 /**
  * Constructor
  *
  * @param HTTP\Request $request
  * @param HTTP\Response $response
  * @param string $format one of png, jpeg, gif
  */
 public function __construct(HTTP\Request $request, HTTP\Response $response, $format = 'png')
 {
     parent::__construct($request, $response);
     // to enabled jpgraphs graphical exception handler
     restore_exception_handler();
     if ($this->request->getParameter('width')) {
         $this->width = $this->request->getParameter('width');
     }
     if ($this->request->getParameter('height')) {
         $this->height = $this->request->getParameter('height');
     }
     $this->colors = Util\Configuration::read('colors');
     $this->graph = new \Graph($this->width, $this->height);
     $this->graph->img->SetImgFormat($format);
     // Specify what scale we want to use,
     $this->graph->SetScale('datlin');
     $this->graph->legend->SetPos(0.03, 0.06);
     $this->graph->legend->SetShadow(FALSE);
     $this->graph->legend->SetFrameWeight(1);
     $this->graph->SetMarginColor('white');
     $this->graph->SetYDeltaDist(65);
     $this->graph->yaxis->SetTitlemargin(36);
     $this->graph->SetTickDensity(TICKD_DENSE, TICKD_SPARSE);
     $this->graph->xaxis->SetFont(FF_ARIAL);
     $this->graph->xaxis->SetLabelAngle(45);
     $this->graph->xaxis->SetLabelFormatCallback(function ($label) {
         return date('j.n.y G:i', $label);
     });
     $this->graph->img->SetAntiAliasing(function_exists('imageantialias'));
 }
Exemple #2
0
 /**
  * constructor
  */
 public function __construct(HTTP\Request $request, HTTP\Response $response)
 {
     parent::__construct($request, $response);
     echo '# source: volkszaehler.org' . PHP_EOL;
     echo '# version: ' . VZ_VERSION . PHP_EOL;
     $this->response->setHeader('Content-type', 'text/csv');
 }
Exemple #3
0
 /**
  * Constructor
  *
  * @param HTTP\Request $request
  * @param HTTP\Response $response
  */
 public function __construct(HTTP\Request $request, HTTP\Response $response)
 {
     parent::__construct($request, $response);
     $this->xmlDoc = new \DOMDocument('1.0', 'UTF-8');
     $this->xmlRoot = $this->xmlDoc->createElement('volkszaehler');
     $this->xmlRoot->setAttribute('version', VZ_VERSION);
     $this->xmlDoc->appendChild($this->xmlRoot);
 }
Exemple #4
0
 /**
  * constructor
  */
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->response->headers->set('Content-Type', 'text/csv');
     ob_start();
     echo '# source:' . CSV::DELIMITER . 'volkszaehler.org' . PHP_EOL;
     echo '# version:' . CSV::DELIMITER . VZ_VERSION . PHP_EOL;
 }
Exemple #5
0
 /**
  * Constructor
  *
  * @param HTTP\Request $request
  * @param HTTP\Response $response
  */
 public function __construct(HTTP\Request $request, HTTP\Response $response)
 {
     parent::__construct($request, $response);
     $this->json = new Util\JSON();
     $this->json['version'] = VZ_VERSION;
     $this->response->setHeader('Content-type', 'application/json');
     $this->setPadding($request->getParameter('padding'));
 }
 /**
  * Constructor
  *
  * @param HTTP\Request $request
  * @param HTTP\Response $response
  */
 public function __construct(Request $request)
 {
     parent::__construct($request);
     // $this->response->headers->set('Content-Type', 'text/xml');
     $this->response->headers->set('Content-type', 'application/xml; charset=UTF-8');
     $this->xmlDoc = new \DOMDocument('1.0', 'UTF-8');
     $this->xmlRoot = $this->xmlDoc->createElement('volkszaehler');
     $this->xmlRoot->setAttribute('version', VZ_VERSION);
     $this->xmlDoc->appendChild($this->xmlRoot);
 }
 /**
  * constructor
  */
 public function __construct(Request $request)
 {
     parent::__construct($request);
     // set default timestamp format
     if (!$this->request->query->has('tsfmt')) {
         $this->request->query->set('tsfmt', 'sql');
     }
     $this->response->headers->set('Content-Type', 'text/csv');
     ob_start();
     echo '# source:' . CSV::DELIMITER . 'volkszaehler.org' . PHP_EOL;
     echo '# version:' . CSV::DELIMITER . VZ_VERSION . PHP_EOL;
 }
Exemple #8
0
 /**
  * Constructor
  */
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->prepareResponse();
     // use StreamedResponse unless pretty-printing is required
     if (Util\Debug::isActivated()) {
         $this->add(Util\Debug::getInstance());
     } else {
         $this->response = new StreamedResponse();
     }
     // add JSON headers
     $this->response->headers->set('Content-Type', 'application/json');
     $this->response->headers->set('Access-Control-Allow-Origin', '*');
 }
 /**
  * Constructor
  */
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->json = new Util\JSON();
     $this->json['version'] = VZ_VERSION;
     // JSONP
     if ($this->padding = $request->parameters->get('padding')) {
         $this->response->headers->set('Content-Type', 'application/javascript');
     } else {
         $this->response->headers->set('Content-Type', 'application/json');
         // enable CORS if not JSONP
         $this->response->headers->set('Access-Control-Allow-Origin', '*');
     }
 }
Exemple #10
0
 /**
  * Constructor
  *
  * @param Symfony\Component\HttpFoundation\Request $request
  * @param string $format one of png, jpeg, gif
  */
 public function __construct(Request $request, $format = 'png')
 {
     parent::__construct($request);
     $this->response->headers->set('Content-Type', 'image/' . $format);
     // load JpGraph
     // NOTE: JpGraph installs its own graphical error handler
     \JpGraph\JpGraph::load();
     \JpGraph\JpGraph::module('date');
     \JpGraph\JpGraph::module('line');
     if ($this->request->query->has('width')) {
         $this->width = $this->request->query->get('width');
     }
     if ($this->request->query->has('height')) {
         $this->height = $this->request->query->get('height');
     }
     $this->colors = Util\Configuration::read('colors');
     $this->graph = new \Graph($this->width, $this->height);
     // disable JpGraph default handler
     restore_exception_handler();
     $this->graph->img->SetImgFormat($format);
     // Specify what scale we want to use,
     $this->graph->SetScale('datlin');
     $this->graph->legend->SetPos(0.03, 0.06);
     $this->graph->legend->SetShadow(FALSE);
     $this->graph->legend->SetFrameWeight(1);
     $this->graph->SetMarginColor('white');
     $this->graph->SetYDeltaDist(65);
     $this->graph->yaxis->SetTitlemargin(36);
     $this->graph->SetTickDensity(TICKD_DENSE, TICKD_SPARSE);
     $this->graph->xaxis->SetFont(FF_ARIAL);
     $this->graph->xaxis->SetLabelAngle(45);
     $this->graph->xaxis->SetLabelFormatCallback(function ($label) {
         return date('j.n.y G:i', $label);
     });
     if (function_exists('imageantialias')) {
         $this->graph->img->SetAntiAliasing(true);
     }
 }
Exemple #11
0
 /**
  * Constructor
  */
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->json = array('version' => VZ_VERSION);
     $this->padding = $request->query->get('padding');
 }