Viewing file: clslevelaword.php (2.46 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class base_levelaword--------------------------
//--PK of base_levelaword ::
// 1. levelawordId
class LevelAword extends clsDB{
var $result;
var $levelawordId;
var $levelawordNameE;
var $levelawordNameT;
function LevelAword(&$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 LevelAword values('$this->levelawordId', '$this->levelawordNameE', '$this->levelawordNameT')";
}else {
$sql = "update LevelAword set levelawordNameE='$this->levelawordNameE',levelawordNameT='$this->levelawordNameT' where levelawordId='$this->levelawordId'";
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from LevelAword where levelawordId='$this->levelawordId'");
}
function GetNextCode(){
$this->SetQuery("select max(levelawordId) as num from LevelAword");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSLevelAword(){
$this->SetQuery("select * from LevelAword order by levelawordId");
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->levelawordId = $this->result['levelawordId'];
$this->levelawordNameE = $this->result['levelawordNameE'];
$this->levelawordNameT = $this->result['levelawordNameT'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
if ($this->SetQuery("select * from LevelAword where levelawordId= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function selectHTML($name, $ID=""){
$s="<select name=\"$name\">\n";
$s.="<option value=\"0\">---เลือกระดับการได้รับรางวัล---\n";
$this->RSLevelAword();
while($this->GetRecord()){
$s.="<option value=\"$this->levelawordId\" ";
$s.=($this->levelawordId==$ID) ? "Selected" : "" ;
$s.=">$this->levelawordNameT\n";
}
return $s.="</select>\n";
}
function RSLevelAwordNameId($xKey){
$this->SetQuery("select * from LevelAword where levelawordNameT like '%$xKey%'order by levelawordId ");
}
function NextPage($pg=1){
if ($this->lastSql<>""){
$this->frRowNum=($pg-1)*$GLOBALS["rowPerPage"];
$sql = $this->lastSql." limit $this->frRowNum,".$GLOBALS["rowPerPage"];
$this->SetQueryPage($sql);
}
}
function NumPage() {
return ceil($this->numRows/$GLOBALS["rowPerPage"]);
}
} //--End class base_levelaword--
?>
|