<?php
require_once (PATH_TABLES . "admin/SoftwareTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class SoftwareClass extends MasterBase {
	
	function __construct($db) {
		$this->db 			= $db ;
		$this->tbl 			= SoftwareTable::C_TABLE ;
		$this->fldid 		= SoftwareTable::C_ID ;
		$this->flddesc 		= SoftwareTable::C_DESC ;
	}
	function __destruct() {
	}

	function isNameFound($name) {
		$filter = $this->db->fieldParam($this->flddesc);
		$params = array() ;
		$params[] = $this->db->valueParam($this->flddesc,$name) ;
		if ($this->db->getRowsCount($this->tbl,$filter,$params) > 0 )
			return true ;
		else
			return false ;
	}

	function deleteSettingRecord($ids){
		$sql = "delete from ". $this->tbl ." where ". $this->fldid ." in ( ".$ids.") ";
		$this->db->executeSql($sql);
	}

	function getSoftwareIDByDesc($desc){
		$sql = "SELECT * FROM " . $this->tbl . " WHERE " . SoftwareTable::C_DESC . " = '" . $desc . "'";
		
		$rows = $this->db->getTable($sql);

		if(!is_null($rows) && count($rows) > 0){
			return $rows[0][SoftwareTable::C_ID];
		}
		return null;
	}
}
?>