<?php

class NewsletterSubscribeWidget extends CWidget {

    public function run() {

        Yii::import('admin.modules.fnewsletter.models.NewsletterSubscriber');
        $model = new NewsletterSubscriber;

        $this->render('form', array('model' => $model));
    }

    /**

     * Performs the AJAX validation.

     * @param NewsletterSubscriber $model the model to be validated

     */
    protected function performAjaxValidation($model) {

        if (isset($_POST['ajax']) && $_POST['ajax'] === 'newsletter-subscriber-form') {

            echo CActiveForm::validate($model);

            Yii::app()->end();
        }
    }

}
