<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'newsletter-form',
    'enableAjaxValidation' => false,
        ));
?>
<div id="headlines" style="width: 99%; padding-left:2%;">
    <img class="right5" width="12" height="7" src="<?php echo Yii::app()->baseUrl; ?>/images/admin/bg.png">
    Automated Newsletter | <a href="<?php echo Yii::app()->createUrl('newsletter/log'); ?>">Log</a>
</div>
<div style="height:525px; background-color:#f7eee1;" id="communicationsbox">
    <div id="row">

        <fieldset id="current">
            <strong><?php
                foreach (Yii::app()->user->getFlashes() as $key => $message) {
                    echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
                }
                ?></strong>
            <legend><strong>Auto Model News Letter</strong> <br />
            </legend>
            <table width="800" cellspacing="0" cellpadding="4">
                <tr>
                    <td width="749" align="center"><?php echo $form->textArea($model, 'content', array('rows' => 10, 'cols' => 80, 'class' => 'ckeditor')); ?> <?php echo $form->error($model, 'content'); ?></td>
                </tr>
                <tr>
                    <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <?php
                        $stopButtopnLabel = "Stop";
                        if ($model->isActive == 'N') {
                            echo "Newsletter stopped";
                            $stopButtopnLabel = "Start";
                        }
                        $disabled = true;
                        if ((date('d') >= 1 && date('d') <= 5) || (date('d') >= 15 && date('d') <= 20))
                            $disabled = false;
                        ?>
                        <?php echo CHtml::submitButton('Update', array('disabled' => $disabled)); ?>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <?php echo CHtml::submitButton($stopButtopnLabel); ?>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <?php echo CHtml::submitButton('send to test group'); ?>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </fieldset>
    </div>
</div>
<?php $this->endWidget(); ?>