Viewing file: 2552-03-04-1.0.01-clsFileUpdate.php (5.51 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class base_Room--------------------------
//--PK of base_Room ::
// 1. roomId
include_once "Db.php";
class FileUpdate extends clsDB{
var $result;
var $fileId;
var $updateDate;
var $filename1;
var $filename2;
var $flagfile;
var $flagupdate;
var $path;
var $detail;
var $sysId;
var $updatetime;
var $flagselect;
var $flagrestore;
var $flaguse;
function FileUpdate(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function AddNew(){
$this->status = 1;
}
function Edit(){
$this->status = 2;
}
function Save(){
if ($this->status==1){
$sql = "insert into FileUpdate values(
'$this->fileId',
'$this->updateDate',
'$this->filename1',
'$this->filename2',
'$this->flagfile',
'$this->flagupdate',
'$this->path',
'$this->detail',
'$this->sysId',
'$this->updatetime',
'$this->flagselect',
'$this->flagrestore',
'$this->flaguse'
)";
}else {
$sql = "update FileUpdate set
updateDate='$this->updateDate',
filename1='$this->filename1',
filename2='$this->filename2',
flagfile='$this->flagfile',
flagupdate='$this->flagupdate',
path='$this->path',
detail='$this->detail',
sysId='$this->sysId',
updatetime='$this->updatetime',
flagselect='$this->flagselect',
flagrestore='$this->flagrestore',
flaguse='$this->flaguse'
where fileId='$this->fileId'";
}
$this->SetQuery($sql);
}
function Delete(){
$this->SetQuery("delete from FileUpdate where fileId='$this->fileId'");
}
function GetNextCode(){
$this->SetQuery("select max(fileId) as num from FileUpdate");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSFileUpdate(){
$this->SetQuery("select * from FileUpdate order by fileId desc,updateDate desc,updatetime desc");
}
function RSFileUpdatenotuse(){
$this->SetQuery("select * from FileUpdate where flaguse='N' order by fileId desc,updateDate desc,updatetime desc");
}
function RSFileUpdatenotuseordertext(){
$this->SetQuery("select * from FileUpdate where flaguse='N' order by filename1");
}
function RSFileUpdate2(){
$this->SetQuery("select * from FileUpdate where (flaguse='Y' and (flagupdate='U' or flagupdate='D')) order by fileId desc,updateDate desc,updatetime desc");
}
function RSFileUpdate2path($xKey){
$this->SetQuery("select * from FileUpdate where (flaguse='Y' and (flagupdate='U' or flagupdate='D')) and path='$xKey'order by fileId desc,updateDate desc,updatetime desc");
}
function RSFileUpdate2pathordertext($xKey){
$this->SetQuery("select * from FileUpdate where (flaguse='Y' and (flagupdate='U' or flagupdate='D')) and path='$xKey'order by filename1");
}
function RSFileUpdatepath(){
$this->SetQuery("select * from FileUpdate where flaguse='Y' group by path");
}
function RSFileUpdategroupname(){
$this->SetQuery("SELECT * FROM `FileUpdate` group by filename1,path order by updatetime desc,updateDate desc");
}
function RSFileUpdategroupname2(){
$this->SetQuery("SELECT * FROM `FileUpdate` group by filename1,path order by fileId");
}
function RSFileUpdategroupnameordertext(){
$this->SetQuery("SELECT * FROM `FileUpdate` group by filename1,path order by filename1");
}
function RSFileUpdategroupnameordertext2(){
$this->SetQuery("SELECT * FROM `FileUpdate` group by filename1,path order by fileId");
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->fileId = $this->result['fileId'];
$this->updateDate = $this->result['updateDate'];
$this->filename1 = $this->result['filename1'];
$this->filename2 = $this->result['filename2'];
$this->flagfile = $this->result['flagfile'];
$this->flagupdate = $this->result['flagupdate'];
$this->path = $this->result['path'];
$this->detail = $this->result['detail'];
$this->sysId = $this->result['sysId'];
$this->updatetime = $this->result['updatetime'];
$this->flagselect = $this->result['flagselect'];
$this->flagrestore = $this->result['flagrestore'];
$this->flaguse = $this->result['flaguse'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
if ($this->SetQuery("select * from FileUpdate where fileId= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByfileId($xKey){
if ($this->SetQuery("select * from FileUpdate where fileId= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchBynotfileId($xKey,$yKey,$zKey){
if ($this->SetQuery("select * from FileUpdate where fileId!= '$xKey' and path='$zKey' and filename1='$yKey' order by updatetime desc,updateDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByfilename1anduse($xKey,$zKey){
if ($this->SetQuery("select * from FileUpdate where filename1= '$xKey' and flaguse='Y' and path='$zKey'")){
return 1;
}else {
return 0;
}
}
function countnodir(){
$this->SetQuery("select count(flagupdate) as num from FileUpdate where flagupdate ='D'");
$result = $this->GetResult();
return $result['num'];
}
function NumRow(){
return $this->GetRowSelected();
}
function Destroy(){
return $this->DestroyDb();
}
function SearchByflagupdateD(){
if ($this->SetQuery("select * from FileUpdate where flagupdate ='D' order by updatetime desc,updateDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByflagupdateD2(){
if ($this->SetQuery("select * from FileUpdate where flagupdate ='D' order by fileId")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
} //--End class base_Room--
?>
|