Ejemplo n.º 1
0
}
if (!isset($import_load) || empty($import_load)) {
    $import_load = 2;
}
// Get is user want to display a day or a month
if (!isset($type)) {
    if (isset($_GET['type'])) {
        $type = getvar('type');
    }
    if (!isset($type) || empty($type)) {
        $type = "day";
    }
}
// Check if there are logs recorded, delete fake logs if it's the case:
if (logs\check_export_table_csv("logs", $main_error) == true) {
    if (logs\are_fake_logs("1", "", "", $main_error)) {
        logs\reset_fake_log();
    }
}
//============================== GET OR SET CONFIGURATION PART ====================
//update_conf is used to define if there is an impact on SD card
$conf_arr["COLOR_HUMIDITY_GRAPH"] = array("update_conf" => "0", "var" => "color_humidity");
$conf_arr["COLOR_TEMPERATURE_GRAPH"] = array("update_conf" => "0", "var" => "color_temperature");
$conf_arr["COLOR_WATER_GRAPH"] = array("update_conf" => "0", "var" => "color_water");
$conf_arr["COLOR_LEVEL_GRAPH"] = array("update_conf" => "0", "var" => "color_level");
$conf_arr["COLOR_PH_GRAPH"] = array("update_conf" => "0", "var" => "color_ph");
$conf_arr["COLOR_EC_GRAPH"] = array("update_conf" => "0", "var" => "color_ec");
$conf_arr["COLOR_OD_GRAPH"] = array("update_conf" => "0", "var" => "color_od");
$conf_arr["COLOR_ORP_GRAPH"] = array("update_conf" => "0", "var" => "color_orp");
$conf_arr["COLOR_PROGRAM_GRAPH"] = array("update_conf" => "0", "var" => "color_program");
foreach ($conf_arr as $key => $value) {
Ejemplo n.º 2
0
        $retarray['plug_1']['legend'] = $retInfo['legend'];
        $retarray['plug_1']['yaxis'] = $retInfo['yaxis'];
        $retarray['plug_1']['curveType'] = $retInfo['curveType'];
        $retarray['plug_1']['unit'] = $retInfo['unit'];
        $retarray['plug_1']['fake_log'] = "0";
        break;
    case "logs":
        if ($_GET['month'] == "day") {
            $endDay = strtotime("+1 day", strtotime($_GET['startDate']));
        }
        // Gets type of each sensor logged
        $db_sensors = logs\get_sensor_db_type($_GET['sensor'], $GLOBALS['SENSOR_DEFINITION']);
        // Retrieve logs curve
        $logsValue = logs\get_sensor_log($_GET['sensor'], $startDay, $endDay, $_GET['month'], $db_sensors[0]['ratio'], $db_sensors[0]['display']);
        // Search if there are fake
        $fake = logs\are_fake_logs($_GET['sensor'], $startDay, $endDay, $_GET['month']);
        // Read information about this sensor
        // Todo : Super moche
        $retInfo = programs\get_curve_information($db_sensors[0]['type'] . "1", $_GET['sensor'] - 1);
        $retarray['sensor_1']['data'] = $logsValue[0];
        // Init return array
        $retarray['sensor_1']['name'] = $retInfo['name'] . " (" . __('SENSOR') . " " . $_GET['sensor'] . " )";
        $retarray['sensor_1']['color'] = $retInfo['color'];
        $retarray['sensor_1']['legend'] = $retInfo['legend'];
        $retarray['sensor_1']['yaxis'] = $retInfo['yaxis'];
        $retarray['sensor_1']['curveType'] = $retInfo['curveType'];
        $retarray['sensor_1']['unit'] = $retInfo['unit'];
        $retarray['sensor_1']['fake_log'] = $fake;
        break;
}
// Encode in JSON format and return array