system: Linux mars.sprixweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
cmd: 

Direktori : /home/pfhr/public_html/classes/Model/
Upload File :
Current File : /home/pfhr/public_html/classes/Model/MCms.php

<?php
class Model_MCms
{

	function showCertificate()
	{
		if(isset($_POST['find']))
		{
		$id=$_POST['txtrollno'];
		$test = "SELECT * FROM `certificate_table` where certificate_rollno='$id'";		
		$obj = new Bin_Query();
		$obj->executeQuery($test);
		return Display_DCms::showCertificate($obj->records);
		}
		else
		{
		$id=$_GET['id'];
		$test = "SELECT * FROM `certificate_table` order by certificate_rollno asc ";		
		$obj = new Bin_Query();
		$obj->executeQuery($test);
		return Display_DCms::showCertificate($obj->records);
		}
	}

	function showResults()
	{
		$id=$_GET['id'];
		$select="select * from certificate_table where certificate_rollno='$id'";
		$obj=new Bin_Query();
		$obj->executeQuery($select);
		return $obj->records[0];	
	}

	function showAnnualMeeting()

	{

		$id=$_GET['id'];

		$test = "SELECT * FROM `photos_table` where photos_cat='am' and photos_year=$id order by photos_id desc ";		

		$obj = new Bin_Query();

		$obj->executeQuery($test);

		return Display_DCms::showPhotos($obj->records);

	}

	

	

	function showMeeting()

	{

		$id=$_GET['id'];

		$test = "SELECT * FROM `photos_table` where photos_cat='m' and photos_year=$id order by photos_id desc ";		

		$obj = new Bin_Query();

		$obj->executeQuery($test);

		return Display_DCms::showPhotos($obj->records);

	}

	

	function showStitching()

	{

		$id=$_GET['id'];

		$test = "SELECT * FROM `photos_table` where photos_cat='s' and photos_year=$id order by photos_id desc ";		

		$obj = new Bin_Query();

		$obj->executeQuery($test);

		return Display_DCms::showPhotos($obj->records);

	}

	

	

	function showVideoGallery()

	{

		$test = "SELECT * FROM categorey_table where categorey_cat='Video Gallery'";		

		$obj = new Bin_Query();

		$obj->executeQuery($test);

		return Display_DCms::showVideoGallery($obj->records);

	}

	

	

	function showVideo()

	{

		$id=$_GET['id'];

		$test = "SELECT * FROM `categorey_table` a,`video_table` b where categorey_id=video_cat_id and categorey_id=$id order by video_id desc ";		

		$obj = new Bin_Query();

		$obj->executeQuery($test);

		return Display_DCms::showVideo($obj->records);

	}

	

	function showCategoryTitle()

	{

		$id=(int)$_GET['id'];

		$inbox="SELECT * FROM categorey_table where categorey_id=$id";

		$obj=new Bin_Query();

		$obj->executeQuery($inbox);

		return $obj->records[0];

	}



	function showWelcome()

	{

		$welcome = "SELECT * FROM cms_table where cms_id=1";		

		$obj = new Bin_Query();

		$obj->executeQuery($welcome);

		$output['title'] = $obj->records[0]['cms_name'] ;

		$content = "<p>".$obj->records[0]['cms_content'];

		if($obj->records[0]['cms_content']!="")

		$content .= "</p>";

		$result = str_replace("&nbsp;",'',$content);

		$output['welcome'] .= html_entity_decode(substr(($result),0,1000));

		

		if(strlen($result)>=1000 && $result!="<p></p>")

			$output['welcome'] .='<p class="readmore"> <a href="?do=cms&action=welcome"> More</a></p>';

		

		return $output;

	}

	

	function showOfficess()
	{
		$offices = "SELECT * FROM office_table order by office_id desc limit 0,2";		
		$obj = new Bin_Query();
		$obj->executeQuery($offices);
		for($i=0;$i<count($obj->records);$i++)

		{
			$output[$i] .= "<ul class='test'>";
			$output[$i] .= $obj->records[$i]['office_name'];
			$output[$i] .= "<li>".html_entity_decode(substr(($obj->records[$i]['office_message']),0,300))."...</li>";
			$output[$i] .= "</ul>";
		}

		return $output;

	}

	function showHowdoes()
	{
		$how = "SELECT * FROM cms_table where cms_id=1";		
		$obj = new Bin_Query();
		$obj->executeQuery($how);
		//$output['title'] = $obj->records[0]['cms_name'] ;
		$output['welcome'] .= html_entity_decode($obj->records[0]['cms_content']) ;
		return $output;
	}

	function showAboutUs()
	{
		$aboutus = "SELECT * FROM cms_table where cms_id=2";		
		$obj = new Bin_Query();
		$obj->executeQuery($aboutus);
		//$output['title'] = $obj->records[0]['cms_name'] ;
		$output['content'] .= "<p>".html_entity_decode($obj->records[0]['cms_content'])."</p>";
		return $output;
	}

	function showNews()
	{
		if(isset($_GET['id']))
		$news="SELECT * FROM news_table where news_id=".$_GET['id'];	
		else
		$news="SELECT * FROM news_table where news_status='active' ORDER BY news_datetime desc";
		$obj=new Bin_Query();
		$obj->executeQuery($news);
		return Display_DCms::showNews($obj->records);
	}
	function showNewsHome()
	{
		if(isset($_GET['id']))
		$news="SELECT * FROM news_table where news_id=".$_GET['id'];	
		else
		$news="SELECT * FROM news_table where news_status='active' ORDER BY news_datetime desc limit 0,2";
		$obj=new Bin_Query();
		$obj->executeQuery($news);
		return Display_DCms::showNewsHome($obj->records);
	}

	function showFaq()
	{
		$faq="SELECT * FROM faq_table";
		$obj=new Bin_Query();
		$obj->executeQuery($faq);
		return Display_DCms::showFaq($obj->records);
	}

	function showHowItWork()
	{
		$howitwork = "SELECT * FROM cms_table where cms_id=4";		
		$obj = new Bin_Query();
		$obj->executeQuery($howitwork);
		//$output['title'] = $obj->records[0]['cms_name'] ;
		$output['content'] .= html_entity_decode($obj->records[0]['cms_content']) ;
		return $output;
	}

	function showHowItWorkhome()
	{
		$howitwork = "SELECT * FROM cms_table where cms_id=4";		
		$obj = new Bin_Query();
		$obj->executeQuery($howitwork);
		//$output['title'] = $obj->records[0]['cms_name'] ;
		$output['content'] .= html_entity_decode(substr(($obj->records[0]['cms_content']),0,550))."..." ;
		return $output;
	}
	function showDailyNews()
	{
		$test = "SELECT * FROM dnews_table";		
		$obj = new Bin_Query();
		$obj->executeQuery($test);
		return Display_DCms::showDailyNews($obj->records);
	}
	function showOffice()
	{
		$test = "SELECT * FROM office_table";		
		$obj = new Bin_Query();
		$obj->executeQuery($test);
		return Display_DCms::showOffice($obj->records);
	}

	function showOffices()
	{
		$test = "SELECT * FROM office_table";		
		$obj = new Bin_Query();
		$obj->executeQuery($test);
		return Display_DCms::showOffices($obj->records);
	}

	function showAskExperts()
	{
		$term = "SELECT * FROM cms_table where cms_id=6";		
		$obj = new Bin_Query();
		$obj->executeQuery($term);
		//$output['title'] = $obj->records[0]['cms_name'] ;
		$output .= "<p>".html_entity_decode($obj->records[0]['cms_content'])."</p>";
		return $output;	
	}

	function showTermsAndConditions()
	{
		$term = "SELECT * FROM cms_table where cms_id=3";		
		$obj = new Bin_Query();
		$obj->executeQuery($term);
		$output .= "<p>".html_entity_decode($obj->records[0]['cms_content'])."</p>";
		return $output;
	}

    function insert()
	{
	$name=$_POST['txtname'];
	$address=$_POST['txtaddress'];
	$phone=$_POST['txtphone'];
	$city=$_POST['txtcity'];
	$sex=$_POST['txtsex'];
	$age=$_POST['txtage'];
	$blood=$_POST['txtbgroup'];
	$date="date";
	$status="Disable";
    $insert="INSERT INTO `donor_table`( `donor_name`, `donor_address`, `donor_phone`, `donor_city`, `donor_sex`, `donor_age`, `donor_blood`, `donor_date`, `donor_status`) VALUES ('$name','$address','$phone','$city','$sex','$age','$blood','$date','$status')";
	$obj=new Bin_Query();
		if($obj->updateQuery($insert))
		{
			$_SESSION['message'] = 'Congratulation you are Successfully Register for SACB Blood Donor';
            header('Location:?do=joinus');
		}
		else
		{
			$_SESSION['error_message'] = 'Oops unable to insert Categories';
			header('Location:?do=contactus');
		}
	}

	function showSearch()	
	{		
		if(isset($_POST['find']))		
		{			
		$bgroup=$_POST['txtbgroup'];	
		$_SESSION['blood_group']=$bgroup;
		$city=$_POST['txtcity'];	
		$select="select * from donor_table where donor_status='Enable'";
		if($bgroup!='')		 	
		$select.=" and donor_blood like'$bgroup' ";			
		if($city!='')		 	
		$select.=" and donor_city like'$city' ";
		if($bgroup=='' && $city=='')
		{				
			header('Location:?do=search');			
		}				
		$obj=new Bin_Query();
		$obj->executeQuery($select);
		return Display_DCms::showSearch($obj->records,0,0,0,0,0,0,0);
		$pagesize=10;
		if(isset($_GET['size']))
		{			
			$pagesize=$_GET['size'];
		}						
		if(isset($_GET['page']))
		{		    			
			$start = trim($_GET['page']-1) *  $pagesize;	
			$end =  $pagesize;		
		}			
		else 		
		{			
			$start = 0;			
			$end =  $pagesize;		
		}			
			$total=0;		
			$query_string = split('&size',$_SERVER['QUERY_STRING']);
			$obj=new Bin_Query();		
			$sql="select * from donor_table order by donor_id";		
			$obj->executeQuery($sql);		
			$total = ceil($obj->totrows/ $pagesize);		
			if($obj->totrows<=$pagesize)		{			
			$sql1="select * from donor_table LIMIT $start,$end";			
			$obj2=new Bin_Query();			
			$obj2->executeQuery($sql1);		
		return Display_DCms::showSearch($obj2->records,1,$this->data['paging'],$this->data['prev'],$this->data['next'],$start,$total,$query_string[0]);		
		}				
		else		
		{				
			$tmp = new Lib_Paging('classic',array('totalpages'=>$total, 'length'=>10),'pagination');
			$this->data['paging'] = $tmp->output;				
			$this->data['prev'] =$tmp->prev;				
			$this->data['next'] = $tmp->next;					 
			$sql1 = "select * from donor_table order by donor_id LIMIT $start,$end";				 
			$obj2 = new Bin_Query();				
			$obj2->executeQuery($sql1);				
			return Display_DCms::showSearch($obj2->records,1,$this->data['paging'],$this->data['prev'],$this->data['next'],$start,$total,$query_string[0]);		
		}				
		}	
	}

	Function showDonnerView()
	{
		$id=$_GET['id'];
		$obj=new Bin_Query();
		$sql="select * from donor_table where donor_icard='$id'";
		$obj->executeQuery($sql);	
		return Display_DCms::showDonnerView($obj->records);

	}
	Function showDonnerDetails()
	{
		$id=$_GET['id'];
		$obj=new Bin_Query();
		$sql="select * from donor_details_table where donor_details_icard='$id'";
		$obj->executeQuery($sql);	
		return Display_DCms::showDonnerDetails($obj->records);
		
	}
}
?>