Добавлена обработка датчика содержания примесей в атмосфере (MQ-серия, аналоговый...
[weathermon.git] / web / archive.php
index 031bce768e2208451d8da000d84b8dbfde2a7eb4..c40386389e5a7e5bea9d368c16ee2b31ed688369 100644 (file)
 
 include('config_local.php');
 include('calendar.php');
 
 include('config_local.php');
 include('calendar.php');
-
-function get_unit($db,$param) {
-
-  $qug = $db -> prepare(
-    'select u.id,u.unit_group from st_parameters st,units u where st.id='.$param.' and st.st_unit=u.id'
-  );
-  $qug -> execute();
-                                    
-  while ($row = $qug -> fetch(PDO::FETCH_ASSOC)) {
-    $from_unit = $row['id'];
-    $unit_group = $row['unit_group'];
-  }
-                                                                       
-  if (!empty($_COOKIE['unit_'.$unit_group])) {
-    $to_unit=intval($_COOKIE['unit_'.$unit_group]);
-  } else {
-    $to_unit=$from_unit;
-  }
-                                                                                                                
-  $qu = $db -> prepare(
-    'select u.name_short from units u where u.id='.$to_unit
-  );
-  $qu -> execute();
-                                                                                                                                                                 
-  while ($row = $qu -> fetch(PDO::FETCH_ASSOC)) {
-    $param_unit = $row['name_short'];
-  }
-  return Array(
-    'from' => $from_unit,
-    'to' => $to_unit,
-    'name' => $param_unit
-  );                                                                                                                                                                                    
-
-}
-
-function convert_unit($db,$value,$from,$to) {
-
-  if ($from==$to) {
-
-    $val = $value;
-
-  } else {
-
-    $qv = $db -> prepare(
-      'select round(unitconv('.$value.','.$from.','.$to.'),2) res'
-    );
-    $qv -> execute();
-                            
-    while ($row = $qv -> fetch(PDO::FETCH_ASSOC)) {
-      $val = $row['res'];
-    }
-
-  }
-                                                        
-  return $val;
-
-}
+include('units.php');
 
 $year = $_REQUEST['year']; 
 $month = $_REQUEST['month'];
 
 $year = $_REQUEST['year']; 
 $month = $_REQUEST['month'];