<?php
/**
 * Installment Plan Info Module
 * 
 * @author  Kyo (AKA Yasuhiro Sota)
 * @version 1.1.3
 * @license Commercial License
 * @package admin
 * @subpackage  admin.model
 */
class ModelModuleInstallmentPlanInfo extends Model {
  
/**
 * Holds the current version of the module.
 *
 * @var string
 */
  private $version = '1.1.3';

/**
 * Constructor.
 *
 * @param object $registry
 * @return void
 */
	public function __construct($registry) {
		parent::__construct($registry);
	}
      
/**
 * Get the current settings of a module.
 *
 * @param string $group
 * @param integer $store_id
 * @return array $data
 */   
	public function getSetting($group, $store_id = 0) {
		$data = array(); 
		
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `group` = '" . $this->db->escape($group) . "'");
		
		foreach ($query->rows as $result) {
			if (!$result['serialized']) {
				$data[$result['key']] = $result['value'];
			} else {
				$data[$result['key']] = unserialize($result['value']);
			}
		}

		return $data;
	}

/**
 * Get product layouts.
 *
 * @param void
 * @return string The current version of the module.
 */
	public function getProductLayouts() {
		$sql = "SELECT `l`.* FROM " . DB_PREFIX . "layout `l`";
    $sql .= " LEFT JOIN `" . DB_PREFIX . "layout_route` `lr` ON (`l`.`layout_id` = `lr`.`layout_id`)";
    $sql .= " WHERE `lr`.`route` = '" . $this->db->escape('product/product') . "'";
    $sql .= " GROUP BY `l`.`layout_id`";
    $sql .= " ORDER BY `l`.`name` ASC";	
		
		$query = $this->db->query($sql);

		return $query->rows;
	}  
  
/**
 * Get the current version of the module.
 *
 * @param void
 * @return string The current version of the module.
 */
  public function version() {
    return $this->version;
  }

/**
 * install method 
 *
 * @param void
 * @return boolean True or false
 */ 
	public function install() {
	}    
  
/**
 * upgrade method 
 *
 * @param void
 * @return boolean True or false
 */ 
	public function upgrade() {
  }

}
?>