<?php
/**
 * Joomla! 1.5 component NS Pro
 *
 * @version $Id: view.html.php 2009-04-28 01:47:12 svn $
 * @author Christopher Mavros
 * @package Joomla
 * @subpackage NS Pro
 * @license GNU/GPL
 *
 * Pro Version of Newsletter Subscriber.
Provides:
Keep subscriptions in database
Unsubscription Page
Optional Confirmation on subscribe/unsubscribe
Subscription Manager
Send Newsletters
Newsletter Manager
Subscription Statistics
Unique Emails (does not allow duplicates)
 *
 * This component file was created using the Joomla Component Creator by Not Web Design
 * http://www.notwebdesign.com/joomla_component_creator/
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the NS Pro component
 */
class NsproViewNspro extends JView {

    function display($tpl = null) {
        $model = $this->getModel();

        $subs = $model->getSubs();
        $subsCount = $model->getSubsCount();

        jimport('joomla.application.component.helper');
        $params = JComponentHelper::getParams( 'com_nspro' );
        $component = JComponentHelper::getComponent( 'com_nspro' );
        $params = new JParameter( $component->params );


        $confirmUnsub = $params->get( 'send_unsub_confirm', '1' );

        $notifyUnsub = $params->get( 'send_unsub', '1' );

        $myEmailLabel = $params->get('unsub_email_label', 'Email:');
        $buttonText = $params->get('unsub_button_text', 'Unsubscribe from Newsletter');
        $emailWidth = $params->get('unsub_email_width', '20');
        $buttonWidth = $params->get('unsub_button_width', '100');


        $recipient = $params->get('unsub_mail_recipient', 'email@email.com');
        $subject = $params->get('unsub_subject', 'Unsubscription from your site..');
        $fromName = $params->get('unsub_from_name', 'Newsletter Subscriber');
        $fromEmail = $params->get('unsub_from_email', 'newsletter_subscriber@yoursite.com');
        $sendingWithSetEmail = $params->get('unsub_sending_from_set', true);

        $fromNameConfirm = $params->get('from_name_confirm', 'Newsletter Subscriber');
        $fromEmailConfirm = $params->get('from_email_confirm', 'newsletter_subscriber@yoursite.com');
        $subjectConfirm = $params->get('subject_confirm', 'Subscription Confirmation');

        $fromNameConfirmun = $params->get('unsub_from_name_confirm', 'Newsletter Subscriber');
        $fromEmailConfirmun = $params->get('unsub_from_email_confirm', 'newsletter_subscriber@yoursite.com');
        $subjectConfirmun = $params->get('unsub_subject_confirm', 'Unsubscription Confirmation');


        $this->assignRef('subs', $subs);
        $this->assignRef('subsCount', $subsCount);

        $this->assignRef('params', $params);

        $this->assignRef('confirmUnsub', $confirmUnsub);
        $this->assignRef('notifyUnsub', $notifyUnsub);

        $this->assignRef('myEmailLabel', $myEmailLabel);
        $this->assignRef('recipient', $recipient);
        $this->assignRef('buttonText', $buttonText);
        $this->assignRef('subject', $subject);
        $this->assignRef('fromName', $fromName);
        $this->assignRef('fromEmail', $fromEmail);
        $this->assignRef('fromNameConfirm', $fromNameConfirm);
        $this->assignRef('fromEmailConfirm', $fromEmailConfirm);
        $this->assignRef('subjectConfirm', $subjectConfirm);
        $this->assignRef('fromNameConfirmun', $fromNameConfirmun);
        $this->assignRef('fromEmailConfirmun', $fromEmailConfirmun);
        $this->assignRef('subjectConfirmun', $subjectConfirmun);
        $this->assignRef('sendingWithSetEmail', $sendingWithSetEmail);
        $this->assignRef('emailWidth', $emailWidth);
        $this->assignRef('buttonWidth', $buttonWidth);

        parent::display($tpl);
    }
}
?>