指挥中心的源程序
<?php if (!defined('JYSYSINC'))
exit('JYSYS:No direct script access allowed');
/**
* 指挥中心-督导员分布
* @version $Id: command_distributed.ctr.php 3 20:57 2013年1月2日 $
* @package Jysys.Libraries
* @copyright Copyright (c) 2012, REY, Inc.
* @link http://www.joyql.com
*/
$control->ispass();
global $curuser, $focus;
$c_c = $focus['curc']['name'];
$c_m = $focus['curm']['name'];
$c_ac = $focus['curac']['name'];
$c_ac = ($c_ac == "") ? 'index_list' : $c_ac;
$viewData = array();
$viewData['m'] = $c_m;
$viewData['c'] = $c_c;
$viewData['ac'] = $c_ac;
$eid_ac = ($c_ac == "") ? $c_c . "_list" : $c_ac;
$viewData['eid'] = $c_m . $c_c . $eid_ac;
$viewData['return'] = request("return");
$infoid = intval(request("infoid"));
$viewData['infoid'] = $infoid;
$viewData['actions'] = request("actions");
$code = request("code");
$viewData['onlineType'] = request("onlineType");
$tplfile = "";
/**
* @body
*/
$customac = array($c_c . '_detail', $c_c . '_locus', $c_c . '_result', $c_c . '_locuslist', $c_c . '_events', $c_c . '_video');
if (in_array($c_ac, $customac)) {
$tplfile = $c_m . '_' . $c_ac . '.tpl';
/**
*详情
*/
if ($c_ac == $c_c . '_detail' && $infoid > 0) {
$gps = sdb::query('select * from __dbprefix__gps_device where deleted=0 and id='.$infoid , false);
if (count($gps) > 0) {
$viewData['gps'] = $gps[0];
$viewData['gps']['fullqy'] = getFullQy($gps[0]['rid']);
}
}
if ($c_c == $c_c . '_locuslist' && $infoid > 0) {
}
if ($code != '') {
$start = urldecode(request("start"));
$end = urldecode(request("end"));
$stime = strtotime($start);
$etime = strtotime($end);
$where = " and gd.code='" . $code . "' ";
if ($stime > 0 && $etime > 0 && $etime > $stime) {
$where .= " and ge.createtime>='" . $start . "' and ge.createtime<='" . $end . "' ";
}
$viewData['locus'] = '[]';
$ge = sdb::query("select ge.id,ge.lonlat,ge.createtime,ge.lon,ge.lat,gd.uname,gd.phone,gd.iscar
from __dbprefix__gps_eventdata as ge
inner join __dbprefix__gps_device AS gd on ge.did=gd.code
where ge.deleted=0 and gd.deleted=0 " . $where, false);
if (count($ge) > 0) {
$arr = array();
foreach ($ge as $val) {
$icon=($val['iscar']==1)?"jcGIS.gif":"gps.gif";
$s = '{"id":"' . $val['id'] . '","name":"' . $val['uname'] . '",';
$s .= '"createdTime":"' . $val['createtime'] . '","code":"' . $code . '",';
$s .= '"lon":"' . $val['lon'] . '","lat":"' . $val['lat'] . '",';
$s .= '"lonlat":"' . $val['lonlat'] . '","phone":"' . $val['phone'] . '","icon":"'.$icon.'"}';
$arr[] = $s;
}
$viewData['locus'] = '[' . implode(',', $arr) . ']';
}
}
$tpl->assign('infoid', $infoid);
} else {
$gpssetting = getgpsspace();
$onlinespace = $gpssetting['onlinespace'];
$online = sdb::query('select count(1) as nums from __dbprefix__gps_device where deleted=0 and
UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(IF(modifytime IS NULL,createtime,modifytime))<=' . $onlinespace, false);
$viewData['online'] = $online[0]['nums'];
//
$onlineGPS = sdb::query('select count(1) as nums from __dbprefix__gps_device where deleted=0 and iscar=1 and
UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(IF(modifytime IS NULL,createtime,modifytime))<=' . $onlinespace, false);
$viewData['onlineGPS'] = $onlineGPS[0]['nums'];
$unline = sdb::query('select count(1) as nums from __dbprefix__gps_device where deleted=0 and
UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(IF(modifytime IS NULL,createtime,modifytime))>' . $onlinespace, false);
$viewData['unline'] = $unline[0]['nums'];
$unlineGPS = sdb::query('select count(1) as nums from __dbprefix__gps_device where deleted=0 and iscar=1 and
UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(IF(modifytime IS NULL,createtime,modifytime))>' . $onlinespace, false);
$viewData['unlineGPS'] = $unlineGPS[0]['nums'];
$viewData['gpsall'] = $viewData['unline'] + $viewData['online'];
}
/**
* @common
*/
$viewData['resultTitle'] = getFuncName($c_m, $c_c);
$viewData['drawLayerId'] = '';
$tpl->assign('pagetitle', '首页-' . $GLOBALS['cfg_webname']); //页面标题
$tpl->assign('pagestyle', array()); //自定义加载样式
$tpl->assign('pagesjsfile', array()); //自定义加载样式
$tpl->assign('pagejavascipt', ''); //自定义加载js
$tpl->assign('viewData', $viewData);
$control->Display($tplfile);
exit('JYSYS:No direct script access allowed');
/**
* GPS类
*
* @version $Id: gps.class.php 1 2012-6-18 $
* @package Jysys.Libraries
* @copyright Copyright (c) 2012, REY, Inc.
* @link http://www.joyql.com
*/
class gps extends models
{
protected $db;
protected $tpl;
protected $curuser;
protected $focus;
/**
* +----------------------------------------------------------
* 析构函数
* +----------------------------------------------------------
* @default
* @access default
* +----------------------------------------------------------
* @return void
* +----------------------------------------------------------
*/
function __construct()
{
global $adb;
global $tpl;
global $curuser, $focus;
$this->db = $adb;
$this->tpl = $tpl;
$this->curuser = array();
$this->curuser['username'] = sessions::get('jysys_username');
$this->curuser['userid'] = sessions::get('jysys_userid');
$this->focus = $focus;
}
/**
* +----------------------------------------------------------
* 操作日志
* +----------------------------------------------------------
* @default
* @access default
* +----------------------------------------------------------
* @return void
* +----------------------------------------------------------
*/
function oplog($op)
{
$oparr = array("userid" => $this->curuser['userid'], "m" => $this->focus['curm']['name'],
"c" => $this->focus['curc']['name'], "ac" => $this->focus['curac']['name'], "op" =>
$op);
uslog($oparr);
}
/**
* +----------------------------------------------------------
* 用人单位同步(同步部分数据)
* +----------------------------------------------------------
* @public
* @access default
* +----------------------------------------------------------
* @print Html
* +----------------------------------------------------------
*/
public function company_update()
{
}
/**
* +----------------------------------------------------------
* 楼栋用人单位
* +----------------------------------------------------------
* @public
* @access default
* +----------------------------------------------------------
* @print Html
* +----------------------------------------------------------
*/
public function company_companybyld_list()
{
check_viewfrom();
if (request("actions") == "list" and request("op") == "ajax") {
$table = '__dbprefix__COMPANY company
Left Join __dbprefix__BUILDING builds ON company.BUILDINGID = builds.ID';
$fields = "company.ID as gs_id,
company.COMPAYID as gs_companyid,
company.COMPANY_NAME as gs_name,
company.ORGCORE as gs_orgcode,
company.BUSINESS_NO as gs_business,
company.ADDRESS as gs_dz,
company.SHEBAO_NO as gs_shebao,
company.BUSINESSNO_YXNX as gs_nx,
company.FRDB as gs_frdb,
company.FR_ZW as gs_frzw,
company.FR_SFZ as gs_f