public function customerName($username) { $customerModel = new Customer_Model_Customer(); $customerName = $customerModel->getCustomerNameByUsername($username); if ($customerName) { return htmlspecialchars($customerName); } return 'Không có'; }
public function doAuthenticate() { // authenticate $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($this); if ($result->isValid()) { // get username $username = $this->getResultRowObject(array('username'))->username; $customerModel = new Customer_Model_Customer(); $customerName = $customerModel->getCustomerNameByUsername($username); // create object to serialize it into session 'Zend_Auth' $obj = new stdClass(); $obj->username = $username; $obj->customerName = $customerName; // store username, name of the user $storage = $auth->getStorage(); $storage->write($obj); return true; } return false; }