Esempio n. 1
0
 /**
  * However Rain Datalogger can have more than 1 sensor.
  * Message from Rain Datalogger's log has information about only 1 sensor. 
  * This function is used to get information about first sensor of this station
  * 
  *  @access protected
  *  @return array 
  */
 protected function getFirstRGSensor()
 {
     $criteria = new CDbCriteria();
     $criteria->with = array('handler', 'first_sensor_feature');
     $criteria->compare('station_id', $this->_station->station_id);
     $criteria->compare('first_sensor_feature.sensor_feature_id', '>0');
     $sensor = StationSensor::model()->find($criteria);
     if (is_null($sensor)) {
         $this->pushWarning('cant_find_rain_sensor', 'Can not find rain sensor for RG station "' . $this->_station->station_id_code . '" in the DB. Sensor value was not saved.');
         return false;
     } else {
         return array('sensor' => $sensor, 'features' => StationSensorFeature::getInfoForHandler($sensor->station_sensor_id));
     }
 }