当前位置: 首页>>代码示例>>PHP>>正文


PHP Prefs::get_device_color方法代码示例

本文整理汇总了PHP中Prefs::get_device_color方法的典型用法代码示例。如果您正苦于以下问题:PHP Prefs::get_device_color方法的具体用法?PHP Prefs::get_device_color怎么用?PHP Prefs::get_device_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Prefs的用法示例。


在下文中一共展示了Prefs::get_device_color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postLocationlog

 public function postLocationlog()
 {
     $device_name = Input::get('device_identifier');
     $timestamp = Input::get('timestamp');
     $courier = Input::get('courier');
     $status = Input::get('status');
     $stepping = Input::get('stepping');
     $device_name = $device_name == '' ? 'all' : $device_name;
     $timestamp = $timestamp == '' ? date('Y-m-d', time()) : $timestamp;
     $courier = $courier == '' ? 'all' : $courier;
     $status = $status == '' ? 'all' : $status;
     //$stepping = ($stepping == '')?10:$stepping;
     $statuses = Config::get('jex.mapdefstatus');
     $model = new Geolog();
     if ($device_name == 'all') {
         $devices = Geolog::distinct('deviceId')->get();
     } else {
         $devices = Geolog::distinct('deviceId')->where('deviceId', 'regexp', '/' . $device_name . '/i')->get('deviceId');
     }
     $locations = array();
     $paths = array();
     $pathdummy = array();
     foreach ($devices->toArray() as $d) {
         $deviceId = $d[0];
         $mapcolor = Prefs::get_device_color($deviceId);
         $timestamps = explode(' - ', $timestamp);
         if (count($timestamps) == 2) {
             $daystart = trim($timestamps[0]) . ' 00:00:00';
             $dayend = trim($timestamps[1]) . ' 23:59:59';
         } else {
             $daystart = $timestamp . ' 00:00:00';
             $dayend = $timestamp . ' 23:59:59';
         }
         $daystart = new MongoDate(strtotime($daystart));
         $dayend = new MongoDate(strtotime($dayend));
         $model = new Geolog();
         $model = $model->where('deviceId', '=', $deviceId)->whereBetween('mtimestamp', array($daystart, $dayend));
         if ($status != 'all') {
             $model = $model->where('status', 'regexp', '/' . $status . '/i');
         }
         /*
                     else{
                         $model = $model->whereIn('status',$statuses);
                     }*/
         $model = $model->where('appname', '=', Config::get('jex.tracker_app'));
         $locs = $model->orderBy('mtimestamp', 'desc')->get();
         //print_r($locs);
         if (count($locs->toArray()) > 0) {
             $path = array();
             $locv = array();
             $curr = null;
             $next = 1;
             $locarr = $locs->toArray();
             //print count($locarr)."|\r\n";
             //for($i = 0; $i < count($locs->toArray());$i++){
             while (!is_null($next)) {
                 if (is_null($curr)) {
                     $curr = array_shift($locarr);
                     $locv[] = (object) $curr;
                 }
                 $next = array_shift($locarr);
                 if (!is_null($next)) {
                     $st = true;
                     $key = strtotime($next['datetimestamp']);
                     if (isset($next['status']) && in_array($next['status'], $statuses)) {
                         $curr = $next;
                         $locv[$key] = (object) $next;
                         $st = false;
                     }
                     if ($st) {
                         $span = doubleval($next['timestamp']) - doubleval($curr['timestamp']);
                         if (abs($span) >= doubleval($stepping) * 60) {
                             $curr = $next;
                             $locv[$key] = (object) $next;
                         }
                     }
                 }
             }
             krsort($locv);
             //print count($locv)."||\r\n";
             foreach ($locv as $t => $l) {
                 //print_r($l);
                 $lat = isset($l->latitude) ? doubleval($l->latitude) : 0;
                 $lng = isset($l->longitude) ? doubleval($l->longitude) : 0;
                 $status = isset($l->status) && $l->status == '' ? $l->status : 'report';
                 if ($lat != 0 && $lng != 0) {
                     $locations[] = array('data' => array('id' => $l->_id, 'lat' => $lat, 'lng' => $lng, 'timestamp' => $l->datetimestamp, 'identifier' => $l->deviceId, 'delivery_id' => $l->deliveryId, 'status' => $status));
                     $path[] = array($lat, $lng);
                     $pathdummy[] = array($l->deviceId, $l->timestamp, $lat, $lng);
                 }
             }
             $paths[] = array('color' => $mapcolor, 'poly' => $path);
         }
     }
     print json_encode(array('result' => 'ok', 'locations' => $locations, 'paths' => $paths, 'pathdummy' => $pathdummy, 'q' => ''));
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:96,代码来源:AjaxController.php


注:本文中的Prefs::get_device_color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。