<?php
class Pampa_User_Adapter_Login {

  // the class instance
  static private $instance;

  // the adapter reference
  private $_adapter;

  public function __construct() {
    // creates the adapter
    $adapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
    $adapter->setTableName("eacin_users");
    $adapter->setIdentityColumn("username");
    $adapter->setCredentialColumn("password");
    $adapter->setCredentialTreatment("MD5(?) AND online = 1");

    // referencia
    $this->_adapter = $adapter;

  }

  /**
   * returns a reference of the class
   * @return Pampa_Auth_Adapter_Cms
   */
  static public function getInstance() {
    if (!isset(self::$instance)) {
      $c = __CLASS__;
      self::$instance = new $c;
    }

    return self::$instance;
  }

  /**
   * returns the adapter
   * @return Zend_Auth_Adapter_DbTable
   */
  public function getAdapter() {
    return $this->_adapter;
  }

}