示例#1
0
 public function actionSend($id)
 {
     $model = Mail::model()->findByPK($id);
     $modelList = CustomerList::model()->findAllByAttributes(array("ListID" => $model->ListID));
     foreach ($modelList as $receiver) {
         //echo $receiver->customer->Email;
         Functions::sendMail("*****@*****.**", $receiver->customer->Email, $model->Name, $model->Text);
     }
     $model->LastSent = date("Y-m-d");
     $model->save();
 }
示例#2
0
 public function actionDeleteCustomer()
 {
     $model = CustomerList::model()->findByAttributes(array("CustomerID" => $_POST["newEmail"], "ListID" => $_POST["listID"]));
     $modelList = Mailist::model()->findByPK($model->ListID);
     if ($model->delete()) {
         echo "<p class='jqueryOk'>Cliente borrado de la lista.</p>";
         $this->renderPartial('_emailist', array('model' => $modelList));
     } else {
         echo "<p class='jqueryError'>Error borrando el cliente. Intentalo de nuevo por favor.</p>";
         $this->renderPartial('_emailist', array('model' => $modelList));
     }
 }
示例#3
0
<?php

$criteria = new CDbCriteria();
$criteria->condition = "UserID = :userid";
$criteria->params = array(':userid' => Yii::app()->user->ID);
$modelCustomers = Customer::model()->findAll($criteria);
?>

<ul style="list-style-type:none;padding-left:0.5em;">
	
	<li><input type="checkbox" class="customerEmailAll" value="0" /> Seleccionar todos<br /><br /></li>

<?php 
foreach ($modelCustomers as $customer) {
    $checked = count(CustomerList::model()->findAllByAttributes(array("ListID" => $model->ID, "CustomerID" => $customer->ID))) > 0 ? "checked" : "";
    ?>
	
	<li><input type="checkbox" class="customerEmail" <?php 
    echo $checked;
    ?>
 value="<?php 
    echo $customer->ID;
    ?>
" /> <?php 
    echo $customer->Email;
    ?>
 (<?php 
    echo $customer->FullName;
    ?>
)</li>