Beispiel #1
0
    public function __construct($options = null)
    {
        parent::__construct($options);

        //Instanciando o translator
        $this->_translator = Nidorx_Translator::getAdapter();
    }
Beispiel #2
0
    /**
     * Faz a validação do formulário de usergroup (usado pelo Admin)
     * 
     * @param Nidorx_Form $form
     * @param Array $data 
     */
    public function validateForm(Zend_Form $form, $data)
    {

        if ($form->isValid($data)) {

            $translator = new Nidorx_Translator();

            $username = $form->getElement('username')->getValue();
            if ($this->_daoUser->getByUsername($username)) {
                $form->getElement('username')->addError($translator->translate('error_username_in_use'));
                $form->addError($translator->translate('error_username_in_use'));
            }

            //Verificando se o email já está em uso
            $email = $form->getElement('email')->getValue();
            if ($this->_daoUser->getByEmail($email)) {
                $form->getElement('email')->addError($translator->translate('error_email_in_use'));
                $form->addError($translator->translate('error_email_in_use'));
            }
        };

        return!$form->isErrors();
    }