Beispiel #1
0
 public function ValidateEmail(Gyuser_Model_User $obj)
 {
     $id = (int) $obj->getId();
     $email = $obj->getEmail();
     if (trim($email) == '') {
         return true;
     }
     if (!$id) {
         $query = "SELECT count(email) as email_count,id FROM clients WHERE email = '{$email}' and status = 1 ";
     } else {
         $query = "SELECT count(email) as email_count,id FROM clients WHERE email = '{$email}' and status = 1 and id != {$id}";
     }
     $db = Zend_Db_Table::getDefaultAdapter();
     $stmt = $db->query($query);
     $row = $stmt->fetchAll();
     $count = $row[0]['email_count'];
     if ($count) {
         $cObj = new Gyuser_Model_Operator();
         $cId = $row[0]['id'];
         $cObj->setId($cId);
         $cObj = $this->findClientNames($cObj);
         $First_name = $cObj->getFirst_name();
         $Last_name = $cObj->getLast_name();
         $rArr = array('f_name' => $First_name, 'l_name' => $Last_name);
         return $rArr;
     } else {
         return true;
     }
 }