예제 #1
0
파일: sleeps.php 프로젝트: MelonGO/KMoving
function read_sleeps($output)
{
    $obj = json_decode($output);
    $meta = $obj->meta;
    $user_xid = $obj->user_xid;
    $data = $obj->data;
    $items = $data->items;
    $size = $data->size;
    for ($index = 0; $index < $size; $index++) {
        $item = $items[$index];
        $place_lat = $item->place_lat;
        $place_lon = $item->place_lon;
        $time_created = $item->time_created;
        $time_created = NumToDate($time_created);
        $time_completed = $item->time_completed;
        $time_completed = NumToDate($time_completed);
        $time_updated = $item->time_updated;
        $time_updated = NumToDate($time_updated);
        $xid = $item->xid;
        $title = $item->title;
        $details = $item->details;
        //array
        $date = $item->date;
        $shared = $item->shared;
        $snapshot_image = $item->snapshot_image;
        $sub_type = $item->sub_type;
        $place_acc = $item->place_acc;
        $place_name = $item->place_name;
        $body = $details->body;
        $sound = $details->sound;
        $tz = $details->tz;
        $awakenings = $details->awakenings;
        $light = $details->light;
        $place_acc = $details->place_acc;
        $mind = $details->mind;
        $asleep_time = $details->asleep_time;
        $awake = $details->awake;
        $rem = $details->rem;
        $duration = $details->duration;
        $smart_alarm_fire = $details->smart_alarm_fire;
        $quality = $details->quality;
        $sunrise = $details->sunrise;
        $sunrise = NumToDate($sunrise);
        $sunset = $details->sunset;
        $sunset = NumToDate($sunset);
        $deep = $duration - $light;
        echo "\n            <div class='row'>\n                <div class='col-md-12'>\n                    <div id='sleeps-content'>\n                        <div class='pull-left animated bounceInLeft' id='sleeps-fall-time'>\n                            <h2>入睡用时</h2>\n                            <p class='fa fa-clock-o fa-2x'>{$asleep_time} min</p>\n                        </div>\n                        <div class='pull-left animated bounceInDown' id='sleeps-awake-num'>\n                            <h2>醒来次数</h2>\n                            <p class='fa fa-eye fa-2x'>{$awakenings}</p>\n                        </div>\n                        <div class='pull-right animated bounceInRight' id='sleeps-awake-time'>\n                            <h2>清醒时间</h2>\n                            <p class='fa fa-clock-o fa-2x'>{$awake} min</p>\n                        </div>\n                        <div class='pull-left animated bounceInLeft' id='sleeps-light'>\n                            <h2>轻度睡眠</h2>\n                            <p class='fa fa-eye-slash fa-2x'>{$light} h</p>\n                        </div>\n                        <div class='pull-right animated bounceInRight' id='sleeps-deep'>\n                            <h2>深度睡眠</h2>\n                            <p class='fa fa-eye-slash fa-2x'>{$deep} h</p>\n                        </div>\n                        <div class='pull-left animated bounceInUp' id='sleeps-total-time'>\n                            <h2>总睡眠</h2>\n                            <p class='fa fa-clock-o fa-2x'>{$duration} h</p>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        ";
        update_sleeps($asleep_time, $awakenings, $awake, $light, $deep, $duration);
    }
}
예제 #2
0
파일: meals.php 프로젝트: MelonGO/KMoving
function read_meals($output)
{
    $obj = json_decode($output);
    $meta = $obj->meta;
    $user_xid = $obj->user_xid;
    $data = $obj->data;
    $items = $data->items;
    $size = $data->size;
    for ($index = 0; $index < $size; $index++) {
        $item = $items[$index];
        //        $place_lat = $item->place_lat;
        //        $place_lon = $item->place_lon;
        $time_created = $item->time_created;
        $time_created = NumToDate($time_created);
        $time_completed = $item->time_completed;
        $time_completed = NumToDate($time_completed);
        $time_updated = $item->time_updated;
        $time_updated = NumToDate($time_updated);
        //        $xid = $item->xid;
        $title = $item->title;
        //        $note = $item->note;
        $details = $item->details;
        //array
        //        $shared = $item->shared;
        $date = $item->date;
        $sub_type = $item->sub_type;
        //        $place_id = $item->place_id;
        //        $place_acc = $item->place_acc;
        //        $place_name = $item->place_name;
        $fiber = $details->fiber;
        $polyunsaturated_fat = $details->polyunsaturated_fat;
        $calories = $details->calories;
        $potassium = $details->potassium;
        //        $num_mealitems_yellow = $details->num_mealitems_yellow;
        $calcium = $details->calcium;
        //        $only_waters = $details->only_waters;
        //        $client_trace = $details->client_trace;
        $carbohydrate = $details->carbohydrate;
        //        $trans_fat = $details->trans_fat;
        //        $num_mealitems_green = $details->num_mealitems_green;
        $saturated_fat = $details->saturated_fat;
        $protein = $details->protein;
        $num_foods = $details->num_foods;
        $monounsaturated_fat = $details->monounsaturated_fat;
        $tz = $details->tz;
        $sodium = $details->sodium;
        $vitamin_c = $details->vitamin_c;
        $vitamin_a = $details->vitamin_a;
        $fat = $details->fat;
        $unsaturated_fat = $details->unsaturated_fat;
        //        $place_type = $details->place_type;
        $sugar = $details->sugar;
        $num_drinks = $details->num_drinks;
        $num_water = $details->num_water;
        $iron = $details->iron;
        //        $num_mealitems_red = $details->num_mealitems_red;
        $food_score = $details->food_score;
        //        $num_mealitems_with_score = $details->num_mealitems_with_score;
        $cholesterol = $details->cholesterol;
        //        $accuracy = $details->accuracy;
        echo "\n            <div class='row'>\n                <div class='col-md-12'>\n                    <div class='pull-left' id='meals-title'>\n                        <div>\n                            <h2>Today I eat</h2>\n                            <p class='fa fa-spoon fa-2x' style='color: white'>{$title}</p>\n                        </div>\n                        <div class='pull-left animated bounceInDown' id='meals-calories'>\n                            <h2>卡路里</h2>\n                            <p class='fa fa-fire fa-2x' style='color: white'>{$calories} cal</p>\n                        </div>\n                        <div class='pull-right animated bounceInDown' id='meals-fat'>\n                            <h2>脂肪</h2>\n                            <p class='fa fa-cubes fa-2x' style='color: white'>{$fat} g</p>\n                        </div>\n                        <div>\n                            <div class='pull-left animated bounceInDown' id='meals-protein'>\n                                <h4>蛋白质</h4>\n                                <p class='fa fa-cube animated bounceInLeft' style='color: white'>{$protein} mg</p>\n                            </div>\n                            <div class='pull-left animated bounceInLeft' id='meals-calcium'>\n                                <h4>钙</h4>\n                                <p class='fa fa-cube' style='color: white'>{$calcium} mg</p>\n                            </div>\n                            <div class='pull-right animated bounceInRight' id='meals-sugar'>\n                                <h4>糖</h4>\n                                <p class='fa fa-cube' style='color: white'>{$sugar} mg</p>\n                            </div>\n                            <div class='pull-right animated bounceInRight' id='meals-carbohydrate'>\n                                <h4>碳水化合物</h4>\n                                <p class='fa fa-cube' style='color: white'>{$carbohydrate} mg</p>\n                            </div>\n                        </div>\n                        <div>\n                            <div class='pull-left animated bounceInLeft' id='meals-cholesterol'>\n                                <h4>胆固醇</h4>\n                                <p class='fa fa-cube' style='color: white'>{$cholesterol} mg</p>\n                            </div>\n                            <div class='pull-left animated bounceInUp' id='meals-vitamin_c'>\n                                <h4>维他命C</h4>\n                                <p class='fa fa-cube' style='color: white'>{$vitamin_c} mg</p>\n                            </div>\n                            <div class='pull-right animated bounceInRight' id='meals-vitamin_a'>\n                                <h4>维他命A</h4>\n                                <p class='fa fa-cube' style='color: white'>{$vitamin_a} mg</p>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        ";
        update_meals($title, $calories, $fat, $protein, $calcium, $carbohydrate, $sugar, $cholesterol, $vitamin_c, $vitamin_a);
    }
}
예제 #3
0
function read_workouts($output)
{
    $obj = json_decode($output);
    $meta = $obj->meta;
    $user_xid = $obj->user_xid;
    $data = $obj->data;
    $items = $data->items;
    $size = $data->size;
    for ($index = 0; $index < $size; $index++) {
        $item = $items[$index];
        $place_lat = $item->place_lat;
        $place_lon = $item->place_lon;
        $time_created = $item->time_created;
        $time_created = NumToDate($time_created);
        $time_completed = $item->time_completed;
        $time_completed = NumToDate($time_completed);
        $time_updated = $item->time_updated;
        $time_updated = NumToDate($time_updated);
        $xid = $item->xid;
        $title = $item->title;
        $route = $item->route;
        $image = $item->image;
        $details = $item->details;
        //array
        $date = $item->date;
        $shared = $item->shared;
        $snapshot_image = $item->snapshot_image;
        $sub_type = $item->sub_type;
        $place_acc = $item->place_acc;
        $place_name = $item->place_name;
        $tz = $details->tz;
        $goal = $details->goal;
        $calories = $details->calories;
        $place_acc = $details->place_acc;
        $bmr = $details->bmr;
        $intensity = $details->intensity;
        $bg_calories = $details->bg_calories;
        $meters = $details->meters;
        $km = $details->km;
        $time = $details->time;
        $bg_active_time = $details->bg_active_time;
        $steps = $details->steps;
        $bmr_calories = $details->bmr_calories;
        echo "\n        <div class='row workouts-detail'>\n            <div class='col-md-12'>\n                <div class='pull-left' id='workouts-title'>\n                    <div>\n                        <h2>锻炼类型</h2>\n                        <p class='fa fa-star-o fa-2x'>{$title}</p>\n                    </div>\n                    <div class='pull-left animated bounceInDown' id='workouts-steps'>\n                        <h3>步数</h3>\n                        <p class='fa fa-paper-plane-o fa-2x'>{$steps}</p>\n                    </div>\n                    <div class='pull-right animated bounceInDown' id='workouts-distance'>\n                        <h3>距离</h3>\n                        <p class='fa fa-angle-double-right fa-2x'>{$km} km</p>\n                    </div>\n                    <div class='pull-left animated bounceInUp' id='workouts-calories'>\n                        <h3>卡路里</h3>\n                        <p class='fa fa-fire fa-2x'>{$calories} cal</p>\n                    </div>\n                    <div class='pull-right animated bounceInUp' id='workouts-time'>\n                        <h3>耗时</h3>\n                        <p class='fa fa-clock-o fa-2x'>{$time} sec</p>\n                    </div>\n                </div>\n            </div>\n        </div>\n        ";
        update_workouts($title, $steps, $km, $calories, $time);
    }
}
예제 #4
0
파일: mood.php 프로젝트: MelonGO/KMoving
function read_mood($output)
{
    $obj = json_decode($output);
    $meta = $obj->meta;
    $user_xid = $obj->user_xid;
    $data = $obj->data;
    $place_lat = $data->place_lat;
    $place_lon = $data->place_lon;
    $time_created = $data->time_created;
    $time_created = NumToDate($time_created);
    $time_updated = $data->time_updated;
    $time_updated = NumToDate($time_updated);
    $xid = $data->xid;
    $title = $data->title;
    $details = $data->details;
    //array
    $date = $data->date;
    $shared = $data->shared;
    $sub_type = $data->sub_type;
    $place_acc = $data->place_acc;
    $place_name = $data->place_name;
    $tz = $details->tz;
    $place_acc = $details->place_acc;
    $mood_image = "";
    switch ($sub_type) {
        case 1:
            $mood_image = "../../img/Amazing.png";
            break;
        case 2:
            $mood_image = "../../img/Pumped_UP.png";
            break;
        case 3:
            $mood_image = "../../img/Energized.png";
            break;
        case 4:
            $mood_image = "../../img/Meh.png";
            break;
        case 5:
            $mood_image = "../../img/Dragging.png";
            break;
        case 6:
            $mood_image = "../../img/Exhausted.png";
            break;
        case 7:
            $mood_image = "../../img/Totally_Done.png";
            break;
    }
    echo "\n        <div class='row'>\n            <div class='col-md-12'>\n                <div class='pull-left animated jello' id='mood-content'>\n                    <h2 style='color: white'>今日心情:</h2>\n                    <img class='img-responsive img-rounded center-block mood-img' src='{$mood_image}'>\n                </div>\n            </div>\n        </div>\n    ";
    update_mood($mood_image);
}
예제 #5
0
파일: moves.php 프로젝트: MelonGO/KMoving
function read_moves($output)
{
    $obj = json_decode($output);
    $meta = $obj->meta;
    $user_xid = $obj->user_xid;
    $data = $obj->data;
    $items = $data->items;
    $size = $data->size;
    for ($index = 0; $index < $size; $index++) {
        $item = $items[$index];
        $time_completed = $item->time_completed;
        $time_completed = NumToDate($time_completed);
        $xid = $item->xid;
        $title = $item->title;
        $type = $item->type;
        $time_created = $item->time_created;
        $time_created = NumToDate($time_created);
        $time_updated = $item->time_updated;
        $time_updated = NumToDate($time_updated);
        $details = $item->details;
        //array
        $date = $item->date;
        $snapshot_image = $item->snapshot_image;
        $active_time = $details->active_time;
        $inactive_time = $details->inactive_time;
        $wo_count = $details->wo_count;
        $wo_longest = $details->wo_longest;
        $bmr = $details->bmr;
        $bg_calories = $details->bg_calories;
        $hourly_totals = $details->hourly_totals;
        //array
        $bmr_day = $details->bmr_day;
        $wo_active_time = $details->wo_active_time;
        $distance = $details->distance;
        $longest_active = $details->longest_active;
        $longest_idle = $details->longest_idle;
        $calories = $details->calories;
        $km = $details->km;
        $series_ids = $details->series_ids;
        $steps = $details->steps;
        $wo_calories = $details->wo_calories;
        $wo_time = $details->wo_time;
        $sunrise = $details->sunrise;
        $sunrise = NumToDate($sunrise);
        $sunset = $details->sunset;
        $sunset = NumToDate($sunset);
        //        update_moves($active_time,$inactive_time,$calories,$wo_calories,
        //            $bg_calories,$bmr_day,$steps,$km);
        echo "\n        <div class='row moves-detail'>\n                <div class='col-md-12'>\n                    <div class='pull-left animated bounceInLeft' id='moves-active-time'>\n                        <h2>活动时间</h2>\n                        <p class='fa fa-clock-o fa-2x'>{$active_time} sec</p>\n                    </div>\n                    <div class='pull-right animated bounceInRight' id='moves-free-time'>\n                        <h2>空闲时间</h2>\n                        <p class='fa fa-clock-o fa-2x'>{$inactive_time} sec</p>\n                    </div>\n                    <div class='pull-left animated bounceInDown' id='moves-total-calories'>\n                        <div>\n                            <h2>总消耗热量</h2>\n                            <p class='fa fa-fire fa-2x'>{$calories} cal</p>\n                        </div>\n                        <div class='pull-left animated bounceInLeft' id='moves-workouts-calories'>\n                            <h4>锻炼消耗热量</h4>\n                            <p class='fa fa-fire fa-1x'>{$wo_calories} cal</p>\n                        </div>\n                        <div class='pull-right animated bounceInRight' id='moves-static-calories'>\n                            <h4>非锻炼消耗热量</h4>\n                            <p class='fa fa-fire fa-1x'>{$bg_calories} cal</p>\n                        </div>\n                    </div>\n                    <div class='pull-left animated bounceInUp' id='moves-metabolic-rate'>\n                        <h2>代谢速率</h2>\n                        <p class='fa fa-heartbeat fa-2x'>{$bmr_day}</p>\n                    </div>\n                    <div class='pull-left animated bounceInLeft' id='moves-steps'>\n                        <h2>步数</h2>\n                        <p class='fa fa-paper-plane-o fa-2x'>{$steps}</p>\n                    </div>\n                    <div class='pull-right animated bounceInRight' id='moves-km'>\n                        <h2>距离</h2>\n                        <p class='fa fa-angle-double-right fa-2x'>{$km} km</p>\n                    </div>\n                </div>\n            </div>\n        ";
        update_moves($active_time, $inactive_time, $calories, $wo_calories, $bg_calories, $bmr_day, $steps, $km);
    }
}