?> <div id="normal-sortables" class="meta-box-sortables ui-sortable"> <div id="referrers" class="postbox "> <div class="handlediv" title="<?php echo __('Click to toggle', 'live-weather-station'); ?> "><br></div> <h3 class="hndle"><span><?php echo $device['station_name']; ?> </span></h3> <div class="inside"> <table cellspacing="0"> <tbody> <?php if (!Owm_Client::is_owm_station($device['_id'])) { ?> <tr> <th scope="row" width="20%" align="left"><img class="lws-logo" src="<?php echo LWS_ADMIN_URL . 'images/NAMain.png'; ?> " /><span class="lws-module-name"><?php echo $device['module_name']; ?> </span></th> <td width="5%"/> <td align="left"> <span> <?php esc_attr_e('Location', 'live-weather-station'); echo ': ' . $device['place']['city'] . ', ' . $device['place']['country'];
/** * Get station's datas. * * @return array An array containing the available station's datas ready to convert to a JS array. * @param boolean $full The array must contain all measured data types including operational datas. * @param boolean $aggregated The array must contain aggregated data types. * @param boolean $reduced The array is reduced. i.e. contains only modules and measures. * @param boolean $computed The array must contain computed data types. * @param boolean $mono The array must contain min/max. * @since 1.0.0 * @access protected */ protected function get_js_array($datas, $full = true, $aggregated = false, $reduced = false, $computed = false, $mono = false) { $result = array(); if (count($datas) == 0) { return $result; } foreach ($datas['devices'] as $device) { $netatmo = !Owm_Client::is_owm_station($device['_id']); $t_module = array(); if ($aggregated && count($device['modules']) > 1 && $netatmo) { $sample = array(); $sample['device_id'] = 'aggregated'; $sample['device_name'] = $device['station_name']; $sample['module_id'] = 'aggregated'; $sample['module_type'] = 'aggregated'; $sample['module_name'] = __('[all modules]', 'live-weather-station'); $sample['measure_values'] = $device['dashboard_data']; $sample['battery_vp'] = 0; $sample['rf_status'] = $device['wifi_status']; $sample['place'] = $device['place']; $t_module[] = array($sample['module_name'], $sample['device_id'], $this->get_td_measure($sample, $full, $aggregated, $reduced, $computed, $mono)); } if ($netatmo || $full) { $sample = array(); $sample['device_id'] = $device['_id']; $sample['device_name'] = $device['station_name']; $sample['module_id'] = $device['_id']; $sample['module_type'] = $device['type']; $sample['module_name'] = $device['module_name']; $sample['measure_values'] = $device['dashboard_data']; $sample['battery_vp'] = 0; $sample['rf_status'] = $device['wifi_status']; $sample['firmware'] = $device['firmware']; $sample['place'] = $device['place']; $t_module[] = array($device['module_name'], $device['_id'], $this->get_td_measure($sample, $full, $aggregated, $reduced, $computed, $mono)); } foreach ($device['modules'] as $module) { if (($module['type'] == 'NAComputed' || $module['type'] == 'NAEphemer') && !$computed) { continue; } if ($module['type'] == 'NAEphemer' && ($computed && !$full)) { continue; } $sample = array(); $sample['device_id'] = $device['_id']; $sample['device_name'] = $device['station_name']; $sample['module_id'] = $module['_id']; $sample['module_type'] = $module['type']; $sample['module_name'] = $module['module_name']; $sample['measure_values'] = $module['dashboard_data']; $sample['battery_vp'] = $module['battery_vp']; $sample['rf_status'] = $module['rf_status']; $sample['firmware'] = $module['firmware']; $sample['place'] = $device['place']; $t_module[] = array($module['module_name'], $module['_id'], $this->get_td_measure($sample, $full, $aggregated, $reduced, $computed, $mono)); } $result[] = array($device['station_name'], $device['_id'], $t_module); } return $result; }