<?php 
/****************************************************************/
/*          e-mo.pl © 2017                                      */
/*          http://www.e-mo.com.pl                              */
/*          e-mail: info@e-mo.pl                                */
/*          produkt: Action2osCommerce                          */
/*          wersja: 1.9.7                                       */
/*          webserwis: oscGold                                  */
/*          sciezka: https://www.e-mo.com.pl/plikit,1918,533545b244d7d.php*/
/*          data: 2017-09-25                                    */
/*          godz: 10:45:30                                      */
/****************************************************************/

class orders_status { 
	public $Conn = 0;
	public $errMsg = '';
	public $errNo= 0;
	public $orders_status_id=0;
	public $language_id=0;
	public $orders_status_name=0;
	public $public_flag=0;
	public $downloads_flag=0;

	public function Dodaj(){
		$zwrot=true;
		$query="Insert orders_status (orders_status_id, language_id, orders_status_name, public_flag, downloads_flag) VALUES (:orders_status_id, :language_id, :orders_status_name, :public_flag, :downloads_flag) ";
		$sth = $this->Conn->prepare($query);

		$sth->bindParam(':orders_status_id', $this->orders_status_id, PDO::PARAM_INT);
		$sth->bindParam(':language_id', $this->language_id, PDO::PARAM_INT);
		$sth->bindParam(':orders_status_name', $this->orders_status_name, PDO::PARAM_STR);
		$sth->bindParam(':public_flag', $this->public_flag, PDO::PARAM_INT);
		$sth->bindParam(':downloads_flag', $this->downloads_flag, PDO::PARAM_INT);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 
	public function Zmien(){
		$zwrot=true;
		$query="Update orders_status SET orders_status_id=:orders_status_id, language_id=:language_id, orders_status_name=:orders_status_name, public_flag=:public_flag, downloads_flag=:downloads_flag
		$sth = $this->Conn->prepare($query);

		$sth->bindParam(':orders_status_id', $this->orders_status_id, PDO::PARAM_INT);
		$sth->bindParam(':language_id', $this->language_id, PDO::PARAM_INT);
		$sth->bindParam(':orders_status_name', $this->orders_status_name, PDO::PARAM_STR);
		$sth->bindParam(':public_flag', $this->public_flag, PDO::PARAM_INT);
		$sth->bindParam(':downloads_flag', $this->downloads_flag, PDO::PARAM_INT);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 
	public function Usun(){
		$zwrot=true;
		$query="Delete from orders_status

		$sth = $this->Conn->prepare($query);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 
	public function Lista(){
		$query='Select * from orders_status Where orders_status_name=:orders_status_name';
		$sth = $this->Conn->prepare($query);
		$sth->bindParam(':orders_status_name', $this->orders_status_name, PDO::PARAM_STR);
		$sth->execute();
		$tablica = array();
		$x=0;

		while ($row = $sth->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))
		{
			foreach ($row as $k => $v)
			{
				$tablica[$x][$k]=trim($v);
			}
			$x++;
		}

		return $tablica;
	}

}
?>
