File: /home/barbeatleanalyti/public_html/barisnew.beatleanalytics.com/site/script/scorecardprt.php
<?php
class script_scorecardprt extends include_scorecardprt
{
// Mandatory variables as per requirement
var $pg = "";
var $acn = "";
var $v = "";
// Mandatory Properties as per requirement
var $DataArr = array();
var $MandatoryFields = array("ReligionName");
var $vArr = array("add","list","edit");
var $ReligionName = "";
var $IsActive = "";
var $sort = "";
var $ReligionID = "";
var $field = "";
var $status = "";
var $error = "";
var $msg = "";
var $perpage = "";
var $start = "";
var $limit = "";
var $SearchValue = "";
var $s = "";
var $link = "";
var $CustomerID = "";
var $SurveyID = "";
var $TokenID = "";
var $FromDate = "";
var $ToDate = "";
var $pType = "";
var $OrgID = ""; // Organization
var $BranchID = ""; // Branches
var $IndustryID = ""; // Industrys
var $StationId = "";
var $QuestionId = "";
var $AuditorId = "";
// Mandatory Method
function __CONSTRUCT($DataArr11){
if($_SERVER['HTTP_HOST'] != '192.168.2.103' && $_SERVER['HTTP_HOST'] != 'localhost' && $_SERVER['HTTP_HOST'] != 'kalpeshpc' ){
error_reporting(0);
}
global $objDB;
// here 'acn' is the variable and UserListInfo is the method name whtich is defined into controller(script) file.
$this->acn = trim(loadVariable("acn",'FetchAllUserInfo'));
$this->v = trim(loadVariable("v",'list'));
// following all are the variables and its default value.
$this->pg = trim(loadVariable("pg",'scorecardprt'));
$this->IsActive = trim(loadVariable("IsActive",''));
$this->ReligionName = trim(loadVariable("ReligionName",''));
$this->error = trim(loadVariable("error",''));
$this->msg = trim(loadVariable("msg",''));
$this->sort = trim(loadVariable("sort",'0'));
$this->ReligionID = trim(loadVariable("ReligionID",'0'));
$this->status = trim(loadVariable("status",''));
$this->field = trim(loadVariable("field",'Religion_Name'));
$this->perpage = trim(loadVariable("perpage",RECORDS_PER_PAGE));
$this->start = trim(loadVariable("start",'1'));
$this->limit = trim(loadVariable("limit",'0'));
$this->SearchValue = trim(loadVariable("SearchValue",''));
$this->s = trim(loadVariable("s",''));
$this->CustomerID = trim(loadVariable("cid",''));
$this->SurveyID = trim(loadVariable("sid",''));
$this->TokenID = trim(loadVariable("tid",''));
$this->pType = trim(loadVariable("ptype",'content'));
$this->FromDate = trim(loadVariable("FromDate",''));
$this->ToDate = trim(loadVariable("ToDate",''));
$this->OrgID = trim(loadVariable("Organization",''));
$this->BranchID = trim(loadVariable("Branches",''));
$this->IndustryID = trim(loadVariable("Industrys",''));
$this->StationId = trim(loadVariable("Station",''));
$this->QuestionId = trim(loadVariable("Question",''));
$this->AuditorId = trim(loadVariable("Auditor",''));
if($this->FromDate == ""){
$this->FromDate = date("d-m-Y",strtotime("-30 days"));
}
if($this->ToDate == ""){
$this->ToDate = date("d-m-Y");
}
//print_r($_POST);
if(!in_array(strtolower($this->v),$this->vArr) ){
// Return post date if controller class does not exists.
ReturnPostFormData($ValidateArr = array(),"error.html","<span class='error-msg'>v's value does not found in <strong>".$pg."</strong> file !</span>",1);
exit;
}
// Check user login or not
$this->CheckMasterAdminLoggedInOrNot($this->pg);
// Set all post and get variables and its value into DataArr(array)
foreach($DataArr11 as $key => $val){
if(in_array($key, $this->MandatoryFields ))
$this->DataArr[$key] = addslashes(trim($val));
}
/*
echo '<pre>';
print_r($_POST);
echo '</pre>';
*/
// set post data to main DBClass file into include
$objDB->PostData = $DataArr11;
} ///// __CONSTRUCT completed /////
// Mandatory Method
public function Process(){
global $objDB;
/*print_r($objDB->objController);
die();*/
// Check DoProcess method found or not into controller file.
if(!method_exists($objDB->objController,"DoProcess") ){
// Rerturn post data if method not found.
ReturnPostFormData($this->DataArr,"error.html","<span class='error-msg'> Method <strong>DoProcess</strong> does not found into <strong></strong> controler login.html file ! </span>",1);
}else{
// Call the DoProcess controller file.
$this->DoProcess();
}
} ///// Process completed /////
// Mandatory Method
private function DoProcess(){
global $objDB;
// Assing mathod name to CallMethod global variagles.
$objDB->CallMethod = $this->acn;
// Check method is exists or not into controller file.
if( method_exists($objDB->objController,$objDB->CallMethod) ){
// Server side validation for mandatory fields.
if( (strtolower($this->v) == 'add' || strtolower($this->v) == 'edit' )&& $this->acn != "FetchAllUserInfo") {
$this->ValidateFields();
}
// Assign the method to the local variable $CallMethod.
$CallMethod = $objDB->CallMethod;
// Call method using the local variable $CallMethod.
$this->$CallMethod();
}else{
// Return post data if mothod does not exist
ReturnPostFormData($this->DataArr,"error.html","<span class='error-msg'> Method <strong>".$objDB->CallMethod."</strong> does not found into model file ! </span>",1);
exit;
}
} ///// DoProcess completed /////
protected function CheckMasterAdminLoggedInOrNot($pg){
// Check user login or not;
if(!isset($_SESSION['UserInfo']) || !isset($_SESSION['UserInfo']['SessionID']) || $_SESSION['UserInfo']['SessionID'] != session_id() && $_SESSION['UserInfo']['UniqueID'] == "" )
{
?>
<script>
window.location.href = 'https://beatleanalytics.com';
</script>
<?php
}
}
// Mandatory Method
private function ValidateFields(){
$ValidateArr = array();
$ValidateArr = $this->DataArr;
$str = $this->pg.".html?v=".$this->v;
// Server side validation for captach value match or not
if(!ValidateFieldBlank($ValidateArr)){
ReturnPostFormData(array(),"users.html?v=add","Required field value should not be blank.",1);
exit;
}
} ///// ValidateFields completed /////
private function AddUserInfo(){
global $objDB;
// Call method form the parent class.
$rsInsertData = parent::InsertUserInfo();
if($rsInsertData){
ReturnPostFormData($this->DataArr,$this->pg.".html","Ya hoo.. Religion Added successfuly ! ",0);
exit;
}else{
// Post data if data does not inserted
ReturnPostFormData($this->DataArr,$this->pg.".html","Ooops ! There is something wrong to registration!",1);
exit;
}
}
public function FetchAllUserInfo(){
global $objDB;
$rsUserInfo = parent::FetchAllUserInfo();
return $rsUserInfo;
}
public function EditReligionData(){
global $objDB;
$rsEditReligionData = parent::EditReligionData();
ReturnPostFormData($this->DataArr = array(),$this->pg.".html","Religion data upldated successfully !",0);
exit;
}
public function ChangeReligionStatus(){
global $objDB;
$rsReligionStatus = parent::ChangeReligionStatus();
unset($objDB->PostData['acn']);
if($rsReligionStatus) {
ReturnPostFormData($objDB->PostData,"users.html","Status chaged successfully.",0);
exit;
}
else {
ReturnPostFormData($objDB->PostData,"users.html","There is something wrong to change status",1);
exit;
}
}
public function DeleteReligionData(){
global $objDB;
$rsDeleteInfo = parent::DeletedData($this->ReligionID);
unset($objDB->PostData['acn']);
if($rsDeleteInfo){
// ReturnPostFormData($this->DataArr = array(),$this->pg.".html","Ya hoo.. Registration successfuly ! ",0);
// exit;
ReturnPostFormData($objDB->PostData,$this->pg.".html","succesfully deleted",0);
exit;
}else{
// Post data if data does not inserted
ReturnPostFormData($objDB->PostData,$this->pg.".html","Ooops ! There is something wrong to registration!",1);
exit;
}
}
} ///// class completed /////
?>