$subject = Get_subject::model()->findAll(array('condition' => 'IsActive=1'));
$subject_list = CHtml::listData($subject, 'email_subjectid', 'subject_text');
echo CHtml::dropDownList('email_subject', '', $subject_list, array('prompt' => 'Select Email Subject', 'required' => true));
?>
        </td>
    </tr>
    <tr>
        <td align="right" style="text-align: right;">
            <label for='body_content'><?php 
$clang->eT("Select Email Body Content : ");
?>
</label>
        </td>
        <td>
            <?php 
$body = Get_body::model()->findAll(array('condition' => 'IsActive=1'));
$test = array();
foreach ($body as $val) {
    $test[$val['email_bodyid']] = 'CONTENT-ID-' . $val['email_bodyid'];
}
//$body_list = CHtml::listData($subject, 'email_bodyid', 'content_text');
echo CHtml::dropDownList('body_content', '', $test, array('prompt' => 'Select Email Body', 'required' => true, 'ajax' => array('type' => 'POST', 'data' => array('body_id' => 'js:this.value'), 'url' => CController::createUrl('admin/get/sa/templatecontent'), 'update' => '#bodycontent')));
?>
        </td>
    </tr>
</table>
<div id="bodycontent" style="text-align: center; margin-top: 1%; "></div>
<p style="padding-top: 1em;">
    <input type='submit' value='<?php 
$clang->eT("Save");
?>
Example #2
0
 function templatecontent()
 {
     $body_id = (int) $_POST['body_id'];
     $sresult = Get_body::model()->findAll(array('condition' => 'email_bodyid = ' . $body_id));
     foreach ($sresult as $value) {
         echo $value['content_text'];
     }
 }