Viewing file: clsalumnimain.php (9.81 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class AlumniMain--------------------------
//--PK of AlumniMain ::
// 1. alumniId
class AlumniMain extends clsDB{
var $result;
var $alumniId;
var $studentId;
var $studentCode;
var $levelId;
var $programId;
var $prefixId;
var $studentName;
var $studentSurname;
var $studentNameEng;
var $studentSurnameEng;
var $creditAttempt;
var $creditSatisfy;
var $GPA;
var $admitAcadYear;
var $admitSemester;
var $admitDate;
var $finishDate;
var $studentPassword;
var $studentEmail;
var $studentYear;
var $studentStatus;
var $officerId1;
var $officerId2;
var $financeStatus;
var $updateUserId;
var $updateDateTime;
var $citizenId;
var $graduateYear;
var $genStatus;
var $genNo;
var $entryTypeId;
var $entryTypeId2;
var $studentSex;
var $scholarId;
var $preAdmitPositionId;
var $totalPoint;
var $honor;
var $medal;
var $exitExam;
var $studentStatusTmp;
var $importtoalumni;
var $glantId;
var $glantDate;
var $glantreqDate;
var $finishAcadYear;
function AlumniMain(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
if ($this->status==1){
//uncomment a line below if your table use ID as running number
//$this->alumniId=$this->GetNextCode();
$sql = "insert into AlumniMain values(
'$this->alumniId',
'$this->studentId',
'$this->studentCode',
'$this->levelId',
'$this->programId',
'$this->prefixId',
'$this->studentName',
'$this->studentSurname',
'$this->studentNameEng',
'$this->studentSurnameEng',
'$this->creditAttempt',
'$this->creditSatisfy',
'$this->GPA',
'$this->admitAcadYear',
'$this->admitSemester',
'$this->admitDate',
'$this->finishDate',
'$this->studentPassword',
'$this->studentEmail',
'$this->studentYear',
'$this->studentStatus',
'$this->officerId1',
'$this->officerId2',
'$this->financeStatus',
'$this->updateUserId',
'$this->updateDateTime',
'$this->citizenId',
'$this->graduateYear',
'$this->genStatus',
'$this->genNo',
'$this->entryTypeId',
'$this->entryTypeId2',
'$this->studentSex',
'$this->scholarId',
'$this->preAdmitPositionId',
'$this->totalPoint',
'$this->honor',
'$this->medal',
'$this->exitExam',
'$this->studentStatusTmp',
'$this->importtoalumni',
'$this->glantId',
'$this->glantDate',
'$this->glantreqDate',
'$this->finishAcadYear'
)";
}else {
$sql = "update AlumniMain set
studentId='$this->studentId',
studentCode='$this->studentCode',
levelId='$this->levelId',
programId='$this->programId',
prefixId='$this->prefixId',
studentName='$this->studentName',
studentSurname='$this->studentSurname',
studentNameEng='$this->studentNameEng',
studentSurnameEng='$this->studentSurnameEng',
creditAttempt='$this->creditAttempt',
creditSatisfy='$this->creditSatisfy',
GPA='$this->GPA',
admitAcadYear='$this->admitAcadYear',
admitSemester='$this->admitSemester',
admitDate='$this->admitDate',
finishDate='$this->finishDate',
studentPassword='$this->studentPassword',
studentEmail='$this->studentEmail',
studentYear='$this->studentYear',
studentStatus='$this->studentStatus',
officerId1='$this->officerId1',
officerId2='$this->officerId2',
financeStatus='$this->financeStatus',
updateUserId='$this->updateUserId',
updateDateTime='$this->updateDateTime',
citizenId='$this->citizenId',
graduateYear='$this->graduateYear',
genStatus='$this->genStatus',
genNo='$this->genNo',
entryTypeId='$this->entryTypeId',
entryTypeId2='$this->entryTypeId2',
studentSex='$this->studentSex',
scholarId='$this->scholarId',
preAdmitPositionId='$this->preAdmitPositionId',
totalPoint='$this->totalPoint',
honor='$this->honor',
medal='$this->medal',
exitExam='$this->exitExam',
studentStatusTmp='$this->studentStatusTmp',
importtoalumni='$this->importtoalumni',
glantId='$this->glantId',
glantDate='$this->glantDate',
glantreqDate='$this->glantreqDate',
finishAcadYear='$this->finishAcadYear'
where alumniId='$this->alumniId'";
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from AlumniMain where alumniId='$this->alumniId'");
}
function GetNextCode(){
$this->SetQuery("select max(alumniId) as num from AlumniMain");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSAlumniMain(){
$this->SetQuery("select * from AlumniMain order by alumniId");
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->alumniId = $this->result['alumniId'];
$this->studentId = $this->result['studentId'];
$this->studentCode = $this->result['studentCode'];
$this->levelId = $this->result['levelId'];
$this->programId = $this->result['programId'];
$this->prefixId = $this->result['prefixId'];
$this->studentName = $this->result['studentName'];
$this->studentSurname = $this->result['studentSurname'];
$this->studentNameEng = $this->result['studentNameEng'];
$this->studentSurnameEng = $this->result['studentSurnameEng'];
$this->creditAttempt = $this->result['creditAttempt'];
$this->creditSatisfy = $this->result['creditSatisfy'];
$this->GPA = $this->result['GPA'];
$this->admitAcadYear = $this->result['admitAcadYear'];
$this->admitSemester = $this->result['admitSemester'];
$this->admitDate = $this->result['admitDate'];
$this->finishDate = $this->result['finishDate'];
$this->studentPassword = $this->result['studentPassword'];
$this->studentEmail = $this->result['studentEmail'];
$this->studentYear = $this->result['studentYear'];
$this->studentStatus = $this->result['studentStatus'];
$this->officerId1 = $this->result['officerId1'];
$this->officerId2 = $this->result['officerId2'];
$this->financeStatus = $this->result['financeStatus'];
$this->updateUserId = $this->result['updateUserId'];
$this->updateDateTime = $this->result['updateDateTime'];
$this->citizenId = $this->result['citizenId'];
$this->graduateYear = $this->result['graduateYear'];
$this->genStatus = $this->result['genStatus'];
$this->genNo = $this->result['genNo'];
$this->entryTypeId = $this->result['entryTypeId'];
$this->entryTypeId2 = $this->result['entryTypeId2'];
$this->studentSex = $this->result['studentSex'];
$this->scholarId = $this->result['scholarId'];
$this->preAdmitPositionId = $this->result['preAdmitPositionId'];
$this->totalPoint = $this->result['totalPoint'];
$this->honor = $this->result['honor'];
$this->medal = $this->result['medal'];
$this->exitExam = $this->result['exitExam'];
$this->studentStatusTmp = $this->result['studentStatusTmp'];
$this->importtoalumni = $this->result['importtoalumni'];
$this->glantId = $this->result['glantId'];
$this->glantDate = $this->result['glantDate'];
$this->glantreqDate = $this->result['glantreqDate'];
$this->finishAcadYear = $this->result['finishAcadYear'];
// Bio
$this->currentAddress = $this->result['currentAddress'];
$this->currentDistrictId = $this->result['currentDistrictId'];
$this->currentAmphurId = $this->result['currentAmphurId'];
$this->currentProvinceId = $this->result['currentProvinceId'];
$this->currentZipcode = $this->result['currentZipcode'];
$this->currentPhoneNo = $this->result['currentPhoneNo'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
if ($this->SetQuery("select * from AlumniMain where alumniId= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function SearchByStudentId($xKey){
if ($this->SetQuery("select * from AlumniMain where studentId= '$xKey'")){
return 1;
}else {
return 0;
}
}
function RSAlumniMainadmitAcadYearAndprogramIdAndstudentStatusAndstudentName($adyear,$programId,$status,$fName,$lName,$genno){
if($adyear == 0)
$adyear = "";
$this->SetQuery("select * from AlumniMain where admitAcadYear LIKE '%$adyear' and programId LIKE '%$programId'and studentStatus LIKE '%$status' and studentName LIKE '%$fName%' and studentSurname LIKE '%$lName%' and genNo LIKE '%$genno' order by studentId");
}
function RSAlumniMainGroupadmitAcadYear($status){
$this->SetQuery("select admitAcadYear from AlumniMain where studentStatus= '$status' group by admitAcadYear");
}
function selectHTMLGroupadmitAcadYear($name, $ID=""){
$s="<select name=\"$name\">\n";
$s.="<option value=\"0\">---เลือกปีการศึกษา---\n";
$this->RSAlumniMainGroupadmitAcadYear(4);
while($this->GetRecord()){
$s.="<option value=\"$this->admitAcadYear\" ";
$s.=($this->admitAcadYear==$ID) ? "Selected" : "" ;
$s.=">$this->admitAcadYear\n";
}
return $s.="</select>\n";
}
function SearchByStudentName($xKey,$yKey){
if ($this->SetQuery("select * from AlumniMain where studentName= '$xKey' and studentSurname='$yKey' ")){
return 1;
}else {
return 0;
}
}
function RSAlumniMainstudentName($Name){
if($Name != "")
$this->SetQuery("select * from AlumniMain where studentName LIKE '%$Name%' or studentSurname LIKE '%$Name%' order by studentId");
else
$this->SetQuery("select * from AlumniMain where studentName LIKE '$Name' order by studentId");
}
function RSAlumniMainJAlumniBioProgramIdAndFinishAcadYear($pg,$fy){
$this->SetQuery("select * from AlumniMain INNER JOIN AlumniBio ON AlumniBio.alumniId = AlumniMain.alumniId where AlumniMain.programId= '$pg' and AlumniMain.graduateYear ='$fy' ");
}
function NextPage($pg){
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 AlumniMain--
?>
|