2013-01-29 08:05:45 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Dataorder 数据申请相关
|
|
|
|
*/
|
|
|
|
class Dataorder
|
|
|
|
{
|
|
|
|
public $db; //PDO
|
|
|
|
|
|
|
|
public $tbl_Metadata = "metadata"; //元数据数据表
|
|
|
|
public $tbl_Metadata_temp = "metadata_temp"; //新元数据缓存表
|
2013-01-29 08:52:54 +00:00
|
|
|
public $tbl_Dataorder = "dataorder"; //dataorder表
|
|
|
|
public $tbl_Offlineapp = "offlineapp"; //offlineapp
|
2013-01-29 08:05:45 +00:00
|
|
|
|
|
|
|
function __construct($db)
|
|
|
|
{
|
|
|
|
$this->db = $db;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function fetchAllOfflineApp($statu=0,$q=""){
|
|
|
|
|
|
|
|
$wheresql = array();
|
|
|
|
|
2013-01-29 08:52:54 +00:00
|
|
|
if ($statu==4)
|
2013-01-29 08:05:45 +00:00
|
|
|
$wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status=4) ";
|
2013-01-29 08:52:54 +00:00
|
|
|
elseif ($statu==-1)
|
2013-01-29 08:05:45 +00:00
|
|
|
$wheresql[] = " (o.pdflink is not null and o.status=-1)";
|
2013-01-29 08:52:54 +00:00
|
|
|
else
|
2013-01-29 08:05:45 +00:00
|
|
|
$wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status in (3,4))";
|
|
|
|
|
|
|
|
if(!empty($q))
|
|
|
|
{
|
|
|
|
$wheresql[] = " (o.username LIKE '%$q%' OR o.unit LIKE '%$q%' OR o.project LIKE '%$q%' OR o.address LIKE '%$q%') ";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(count($wheresql)>0)
|
|
|
|
{
|
|
|
|
$wheresql = " WHERE ".join(" AND ",$wheresql);
|
|
|
|
}else{
|
|
|
|
$wheresql = "";
|
|
|
|
}
|
|
|
|
|
2013-01-29 08:52:54 +00:00
|
|
|
$sql = "select distinct(o.*),d.status as datastatus from ".$this->tbl_Offlineapp." o
|
|
|
|
left join ".$this->tbl_Dataorder." d on o.id = d.offlineappid
|
2013-01-29 08:05:45 +00:00
|
|
|
$wheresql
|
|
|
|
order by o.ts_created desc";
|
|
|
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
$rows = $rs->fetchAll();
|
|
|
|
|
|
|
|
return $rows;
|
|
|
|
}
|
2013-01-29 08:52:54 +00:00
|
|
|
|
|
|
|
|
2013-01-29 08:05:45 +00:00
|
|
|
}
|