Esempio n. 1
0
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-language" content="en" />
	<meta http-equiv="expires" content="-1" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta name="author" content="guomf" />
	<meta name="copyright" content="GNU" />
	<meta name="robots" content="NOFOLLOW" />
	<title>TestLink</title>
</head>
<body>
<?php 
require '../third_party/PHPExcel/PHPExcel.php';
$time_start = $_POST['time_start'];
$time_stop = $_POST['time_stop'];
$tplan_name = $_POST['tplanname'];
$alldata = getMonthReport(3, $time_start, $time_stop, $tplan_name);
if ($alldata == 0) {
    echo "</br><p align='center'>该时间段内没有执行记录,请重新选择时间段!</p>";
    echo "</br><p align='center'><a href='index.php'>BACK</a></p>";
} else {
    ob_clean();
    $objPHPExcel = new PHPExcel();
    $objPHPExcel->getProperties()->setCreator('DCN TestLink')->setLastModifiedBy('DCN TestLink')->setTitle('DCN Weekly Report');
    $objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
    $objPHPExcel->getDefaultStyle()->getAlignment()->setWrapText(TRUE);
    $objPHPExcel->setActiveSheetIndex(0);
    $objActSheet = $objPHPExcel->getActiveSheet();
    $objActSheet->mergeCells('A1:K1');
    $objActSheet->setCellValue('A1', 'DCN测试中心确认测试执行情况:' . $time_start . '至' . $time_stop);
    $objActSheet->getStyle('A1')->getFont()->setBold(TRUE);
    $objActSheet->getStyle('A2')->getFont()->setBold(TRUE);
    }
    //retrieve user's weather station data
    try {
        $data = $client->getData();
    } catch (Netatmo\Exceptions\NAClientException $ex) {
        echo "An error occured while retrieving data: " . $ex->getMessage() . "\n";
        die;
    }
    if (!isset($data['devices']) || !is_array($data['devices']) || count($data['devices']) < 1) {
        echo "User has no devices \n";
        die;
    }
    //In this example, we will only deal with the first weather station linked to the user account
    $device = $data['devices'][0];
    //last month report
    $reports = getMonthReport($device, $client);
    //Get device timezone
    if (!is_null($device) && !empty($device)) {
        if (isset($device['place']['timezone'])) {
            $tz = $device['place']['timezone'];
        } else {
            $tz = 'GMT';
        }
        //print data
        ?>
<html>
<meta charset="UTF-8">
    <body>
        <div style = "text-align:center;">
            <h2><?php 
        echo $device['station_name'];