/** * Send the reply */ public function actionsend() { if (isset($_POST['id']) && ($model = ContactUs::model()->findByPk($_POST['id']))) { // Add the new message $message = Yii::t('contactus', "You have received a new reply from <b>{replyername}</b><br /><br />\n\t\t\t\t\t\t\t\t\t\t\t =====================<br />\n\t\t\t\t\t\t\t\t\t\t\t {msg}<br />\n\t\t\t\t\t\t\t\t\t\t\t =====================<br /><br />\n\t\t\t\t\t\t\t\t\t\t\t Regards, The {team} Team.<br /><br />", array('{replyername}' => Yii::app()->user->username, '{msg}' => $_POST['message'], '{team}' => Yii::app()->name)); // Build Old Message $message .= Yii::t('contactus', "New Contact Us Form Submitted<br /><br />\n\t\t\t\t\t\t\t\t\t\t Id: {id}<br />\n\t\t\t\t\t\t\t\t\t\t\tBy: {name}<br />\n\t\t\t\t\t\t\t\t\t\t\tEmail: {email}<br />\n\t\t\t\t\t\t\t\t\t\t\tSubject: {subject}<br />\n\t\t\t\t\t\t\t\t\t\t\t========================<br />\n\t\t\t\t\t\t\t\t\t\t\t{msg}<br />\n\t\t\t\t\t\t\t\t\t\t\t========================<br /><br />\n\t\t\t\t\t\t\t\t\t\t\tRegards, the {team} Team.", array('{id}' => $model->id, '{name}' => $model->name, '{email}' => $model->email, '{subject}' => $model->subject, '{msg}' => $model->content, '{team}' => Yii::app()->name)); $email = Yii::app()->email; $email->subject = Yii::t('contactus', 'Re: {subject}', array('{subject}' => $model->subject)); $email->to = $_POST['email'] ? $_POST['email'] : $model->email; $email->from = Yii::app()->params['emailout']; $email->replyTo = Yii::app()->params['emailout']; $email->message = $message; $email->send(); } else { exit; } }
echo CHtml::activeLabel($model, 'email'); ?> <?php echo CHtml::activeTextField($model, 'email', array('class' => 'textboxcontact tiptopfocus', 'title' => Yii::t('contactus', 'Please enter your email address'))); ?> <?php echo CHtml::error($model, 'email', array('class' => 'errorfield')); ?> <br /> <?php echo CHtml::activeLabel($model, 'subject'); ?> <?php echo CHtml::activeDropDownList($model, 'subject', ContactUs::model()->getTopics(), array('class' => 'textboxcontact')); ?> <?php echo CHtml::error($model, 'subject', array('class' => 'errorfield')); ?> <br /> <?php echo CHtml::activeLabel($model, 'content'); ?> <?php echo CHtml::activeTextArea($model, 'content', array('class' => 'textareacontact tiptopfocus', 'title' => Yii::t('contactus', 'Please enter your message'))); ?> <?php echo CHtml::error($model, 'content', array('class' => 'errorfield'));
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return ContactUs the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ContactUs::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
* @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-dressing * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt */ $this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task)); $contactUs = $id ? ContactUs::model()->findByPk($id) : new ContactUs('search'); /** @var YdActiveForm $form */ $form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'contactUs-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/contactUs/delete', 'id' => $id, 'task' => $task, 'confirm' => 1))); echo $this->getGridIdHiddenFields($id); echo $form->beginModalWrap(); echo $form->errorSummary($contactUs); echo '<fieldset>'; echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>'; $contactUss = ContactUs::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')'); if ($contactUss) { echo '<ul>'; foreach ($contactUss as $contactUs) { echo '<li>'; echo $contactUs->getName(); echo '</li>'; } echo '</ul>'; } echo '</fieldset>'; echo $form->endModalWrap(); echo '<div class="' . $form->getSubmitRowClass() . '">'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right'))); echo '</div>'; $this->endWidget();
/** * Delete an item */ public function actiondelete() { if (isset($_GET['id']) && ($model = ContactUs::model()->findByPk($_GET['id']))) { $model->delete(); Yii::app()->user->setFlash('success', Yii::t('contactus', 'Item Deleted.')); $this->redirect(array('index')); } else { $this->redirect(array('index')); } }