<?php
/**
 * This is a class file used for Student Library Management.
 *
 * PHP version 5
 *
 * @category Admin_Tool
 * @package  Admin_Tool
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  Aum Infosys
 * @version  CVS:1.0.1
 * @link     http://auminfosys.com/
 * @filesource
 */

/**
 * This is a class named Book Management.
 *
 * @category School Management System
 * @package  School Management System
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  Aum Infosys
 * @version  Release: 1.0.1
 * @link     http://auminfosys.com/
 *
 */

class PublisherMgmt
{
    /**
     * @var public $book_id This is the Book id.
     */
    public $publisher_id;
	
	/**
     * @var public $school_id This is the School id.
     */
    public $publisher_name;
	
	/**
     * @var public $book_registerno This is the Book Registerno.
     */
    public $contact_no1;
	
	/**
     * @var public $book_category This is the Book Catagory.
     */
    public $contact_no2;
	
	/**
     * @var public $book_divno This is the Book Divno.
     */
    public $address;
	

   
    function getAllRecords($limit=0,$start=0,$condition,$order_field,$order_type)
    {
		$qry = "";
		$qry = "SELECT * FROM cms_publishermaster WHERE school_id = ".$_SESSION['aCollegeId'];
		
		
		if ($condition != "" ) {
            $qry.= $condition;
        }
		
		if ($order_field !="" && $order_type !="") {
            $qry.= " order by $order_field $order_type";
        }

        if (intval($limit) > 0 && intval($start) >=0) {
            $qry.= " Limit $start , $limit";
        }
     // 	print $qry;
        $out=dbQuery($qry);
			
			if (dbRows($out)>0){
            	return $out;							
        	}
			return ;		
    }
		function add()
    	{
			global $SQLDateFormat;
				
            $Qry1 = "";
			$Qry1 .= "school_id='"			.Escape($_SESSION['aCollegeId'])."',"; 	
			$Qry1 .= "publisher_name='"			.Escape($this->publisher_name)."',"; 	
			$Qry1 .= "contact_no1='"		.Escape($this->contact_no1)."',"; 	
			$Qry1 .= "contact_no2='"		.Escape($this->contact_no2)."',"; 	
			$Qry1 .= "address='"			.Escape($this->address)."',"; 	
		 	
					
						
			if($Qry1 != ""){
                $Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
                $qry = "INSERT INTO cms_publishermaster SET " . $Qry1 . " ";
                dbQuery($qry);
                $this->publisher_id=dbInsertedId();
			}
    	}

    	function edit()
    	{
			global $SQLDateFormat;
			
			  $Qry1 = "";
			$Qry1 .= "school_id='"			.Escape($_SESSION['aCollegeId'])."',"; 	
			$Qry1 .= "publisher_name='"			.Escape($this->publisher_name)."',"; 	
			$Qry1 .= "contact_no1='"		.Escape($this->contact_no1)."',"; 	
			$Qry1 .= "contact_no2='"		.Escape($this->contact_no2)."',"; 	
			$Qry1 .= "address='"			.Escape($this->address)."',"; 	
		 	
			
									
			if($Qry1 != ""){
            	$Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
                $qry = "UPDATE cms_publishermaster SET " . $Qry1 . " WHERE publisher_id=".$this->publisher_id;
                dbQuery($qry);
            }            
    	}
	
    	function delete()
    	{		
			$qry = "DELETE FROM cms_publishermaster WHERE publisher_id IN (".$this->publisher_id.") ";
        	dbQuery($qry);
   		}

}
?>