public function getFieldInput($field)
    {
        $model = ClassRegistry::init($this->usersModel);

        switch ($field) {
            case 'username':
                $username = trim($this->in('Username:'));

                if (!$username) {
                    $username = $this->getFieldInput($field);

                } else {
                    $result = $model->find('count', array(
                        'conditions' => array($model->alias . '.' . $this->userFields['username'] => $username)
                    ));

                    if ($result) {
                        $this->out('<error>Username already exists, please try again</error>');
                        $username = $this->getFieldInput($field);
                    }
                }

                return $username;
                break;

            case 'email':
                $email = trim($this->in('Email:'));

                if (!$email) {
                    $email = $this->getFieldInput($field);

                } else if (!Validation::email($email)) {
                    $this->out('<error>Invalid email address, please try again</error>');
                    $email = $this->getFieldInput($field);

                } else {
                    $result = $model->find('count', array(
                        'conditions' => array($model->alias . '.' . $this->userFields['email'] => $email)
                    ));

                    if ($result) {
                        $this->out('<error>Email already exists, please try again</error>');
                        $email = $this->getFieldInput($field);
                    }
                }

                return $email;
                break;

            // Password, others...
            default:
                $value = trim($this->in(sprintf('%s:', Inflector::humanize($field))));

                if (!$value) {
                    $value = $this->getFieldInput($field);
                }

                return $value;
                break;
        }
    }
public function getFieldInput($field)
    {
        $model = ClassRegistry::init($this->usersModel);

        switch ($field) {
            case 'username':
                $username = trim($this->in('Username:'));

                if (!$username) {
                    $username = $this->getFieldInput($field);

                } else {
                    $result = $model->find('count', array(
                        'conditions' => array($model->alias . '.' . $this->userFields['username'] => $username)
                    ));

                    if ($result) {
                        $this->out('<error>Username already exists, please try again</error>');
                        $username = $this->getFieldInput($field);
                    }
                }

                return $username;
                break;

            case 'email':
                $email = trim($this->in('Email:'));

                if (!$email) {
                    $email = $this->getFieldInput($field);

                } else if (!Validation::email($email)) {
                    $this->out('<error>Invalid email address, please try again</error>');
                    $email = $this->getFieldInput($field);

                } else {
                    $result = $model->find('count', array(
                        'conditions' => array($model->alias . '.' . $this->userFields['email'] => $email)
                    ));

                    if ($result) {
                        $this->out('<error>Email already exists, please try again</error>');
                        $email = $this->getFieldInput($field);
                    }
                }

                return $email;
                break;

            // Password, others...
            default:
                $value = trim($this->in(sprintf('%s:', Inflector::humanize($field))));

                if (!$value) {
                    $value = $this->getFieldInput($field);
                }

                return $value;
                break;
        }
    }
public function getFieldInput ( $ field ) { $ model = ClassRegistry :: init ( $ this -> usersModel ) ; switch ( $ field ) { case 'username' : $ username = trim ( $ this -> in ( 'Username:' ) ) ; if ( ! $ username ) { $ username = $ this -> getFieldInput ( $ field ) ; } else { $ result = $ model -> find ( 'count' , array ( 'conditions' => array ( $ model -> alias . '.' . $ this -> userFields [ 'username' ] => $ username ) ) ) ; if ( $ result ) { $ this -> out ( '<error>Username already exists, please try again</error>' ) ; $ username = $ this -> getFieldInput ( $ field ) ; } } return $ username ; break ; case 'email' : $ email = trim ( $ this -> in ( 'Email:' ) ) ; if ( ! $ email ) { $ email = $ this -> getFieldInput ( $ field ) ; } else if ( ! Validation :: email ( $ email ) ) { $ this -> out ( '<error>Invalid email address, please try again</error>' ) ; $ email = $ this -> getFieldInput ( $ field ) ; } else { $ result = $ model -> find ( 'count' , array ( 'conditions' => array ( $ model -> alias . '.' . $ this -> userFields [ 'email' ] => $ email ) ) ) ; if ( $ result ) { $ this -> out ( '<error>Email already exists, please try again</error>' ) ; $ email = $ this -> getFieldInput ( $ field ) ; } } return $ email ; break ; // Password, others...
 default : $ value = trim ( $ this -> in ( sprintf ( '%s:' , Inflector :: humanize ( $ field ) ) ) ) ; if ( ! $ value ) { $ value = $ this -> getFieldInput ( $ field ) ; } return $ value ; break ; } }
Get the value of an input.

@param string $field
@return string
Get the value of an input .