/**
  * Query for data by given channel or group or multiple channels
  *
  * @param Model\Entity $entity - can be null
  */
 public function get(Model\Channel $entity = null)
 {
     $from = $this->request->parameters->get('from');
     $to = $this->request->parameters->get('to');
     $tuples = $this->request->parameters->get('tuples');
     $groupBy = $this->request->parameters->get('group');
     // single entity interpreter
     if ($entity) {
         $class = $entity->getDefinition()->getInterpreter();
         return new $class($entity, $this->em, $from, $to, $tuples, $groupBy, $this->options);
     }
     // multiple UUIDs
     if ($uuids = self::makeArray($this->request->parameters->get('uuid'))) {
         $interpreters = array();
         foreach ($uuids as $uuid) {
             $entity = $this->ec->getSingleEntity($uuid, true);
             // from cache
             $interpreters[] = $this->get($entity);
         }
         return $interpreters;
     }
 }
Пример #2
0
 /**
  * check weather a axis for the indicator of $channel exists
  *
  * @param \Volkszaehler\Model\Channel $channel
  */
 protected function getAxisIndex(\Volkszaehler\Model\Channel $channel)
 {
     $type = $channel->getType();
     if (!array_key_exists($type, $this->axes)) {
         $count = count($this->axes);
         if ($count == 0) {
             $this->axes[$type] = -1;
             $yaxis = $this->graph->yaxis;
         } else {
             $this->axes[$type] = $count - 1;
             $this->graph->SetYScale($this->axes[$type], 'lin');
             $yaxis = $this->graph->ynaxis[$this->axes[$type]];
         }
         $yaxis->title->Set($channel->getDefinition()->getUnit());
         $yaxis->SetFont(FF_ARIAL);
         $yaxis->title->SetFont(FF_ARIAL);
         $yaxis->SetTitleMargin('50');
     }
     return $this->axes[$type];
 }