public function repMails($email, $id)
 {
     //получаю шаблон письма
     $sms = Mails::model()->findByPk(1);
     if ($sms) {
         //вставляю  тело
         $html = $sms['body'];
         //тема
         $subject = $sms['theme'];
         //нахожу нужный купон
         $coupon = Coupon::model()->findByPk($id);
         //название купона
         $product = $coupon['title'];
         //скидка
         $sale = $coupon['discount'];
         //цен до скидки
         $before = $coupon['discountPrice'] . " рублей";
         if ($before == 0) {
             $before = "Не ограничена";
             $after = "Не ограничена";
         } else {
             //цена после скидки
             $after = round($before - $sale * $before / 100, 2);
             $after .= " рублей";
         }
         //ссылка на купон
         $link = $_SERVER['HTTP_HOST'] . Yii::app()->createUrl("/coupon", array('id' => $coupon['id'], 'title' => $coupon['title']));
         $link = "<a href='http://" . $link . "'>" . $link . "</a>";
         //подставляю в шаблон
         $html = str_replace('[product]', $product, $html);
         $html = str_replace('[before]', $before, $html);
         $html = str_replace('[after]', $after, $html);
         $html = str_replace('[sale]', $sale, $html);
         $html = str_replace('[link]', $link, $html);
         //отправляем письмо
         $this->sendMail($email, $subject, $html);
     }
 }
Example #2
0
 public function executeSendmail()
 {
     $subject = $this->getRequestParameter('subject');
     $body = $this->getRequestParameter('mailbody');
     $loggeduser = UserPeer::retrieveByPK($this->getUser()->getAttribute('userid'));
     $sendermail = $loggeduser->getEmail();
     $sendername = $loggeduser->getFullname();
     $counts = 0;
     $countf = 0;
     if ($this->getRequestParameter('type') == 'one') {
         $user = UserPeer::retrieveByPK($this->getRequestParameter('toid'));
         $tomail = $user->getEmail();
         $toname = $user->getFullname();
         //$mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $tomail, $subject, $body);
         $mail = new Mails();
         $mail->setApproved(0);
         $mail->setSubject($subject);
         $mail->setMessage($body);
         $mail->setSendername($sendername);
         $mail->setSendermail($sendermail);
         $mail->setRecipientmail($tomail);
         $mail->setRecipientname($toname);
         $mail->save();
         $this->setFlash('notice', 'Mail to <b>' . $user->getFullname() . '</b> has been saved successfully. Will be sent after approval');
     } elseif ($this->getRequestParameter('type') == 'bulk') {
         $userids = $this->getUser()->getAttribute('bulkmailids');
         $this->getUser()->getAttributeHolder()->remove('bulkmailids');
         foreach ($userids as $uid) {
             $user = UserPeer::retrieveByPK($uid);
             $tomail = $user->getEmail();
             $toname = $user->getFullname();
             if ($tomail) {
                 //$mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body);
                 $mail = new Mails();
                 $mail->setApproved(0);
                 $mail->setSubject($subject);
                 $mail->setMessage($body);
                 $mail->setSendername($sendername);
                 $mail->setSendermail($sendermail);
                 $mail->setRecipientmail($tomail);
                 $mail->setRecipientname($toname);
                 $mail->save();
                 $counts++;
             } else {
                 $countf++;
             }
         }
         $this->setFlash('notice', '<b>' . $counts . '</b> mails saved succesfully for approval users successfully. While <b>' . $countf . '</b> users dont have an email.');
     }
     $this->redirect('search/result?page=' . $this->getUser()->getAttribute('srpage'));
     /*$sendermail = sfConfig::get('app_from_mail');
     		$sendername = sfConfig::get('app_from_name');*/
     /*$userids = $this->getUser()->getAttribute('uu');
     		$this->getUser()->getAttributeHolder()->remove('uu');*/
     /*		if($option == 'm'){
     			echo count($userids);
     			foreach ($userids as $uid){
     				echo "hello";
     				$ab = $uid;
     				$user = UserPeer::retrieveByPK($uid);
     				$to = $user->getEmail();
     				$mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body);
     			}
     		}
     		else {
     		echo count($userids);
     			foreach ($userids as $uid){
     				echo "hello";
     				$ab = $uid;
     				$user = UserPeer::retrieveByPK($uid);
     				$to = $user->getEmail();
     				$mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body);
     			}
     		}*/
 }
Example #3
0
    if ($_REQUEST["accion"] == "Guardar") {
        $oMail = new Maile($_REQUEST["id_mail"]);
        $oMail->Seccion = $_REQUEST["seccion"];
        $oMail->Mail = $_REQUEST["mail"];
        $oMail->Persistir();
        header("Location: " . $_SERVER['PHP_SELF']);
    }
    if ($_REQUEST["accion"] == "Editar") {
        $oMail = new Maile($_REQUEST["id_mail"]);
        $smarty->assign("id_mail", $oMail->Id);
        $smarty->assign("seccion", $oMail->Seccion);
        $smarty->assign("mail", $oMail->Mail);
    }
    if ($_REQUEST["accion"] == "Borrar") {
        $oMail = new Maile($_REQUEST["id_mail"]);
        $oMail->Eliminar();
        header("Location: " . $_SERVER['PHP_SELF']);
    }
}
$oMails = new Mails();
$rs = $oMails->GetAll();
$row = $rs->_array;
if (count($row) >= 1) {
    foreach ($row as $key => $value) {
        $fields = $value;
        $aDatos[] = array("id_mail" => $fields["ID_MAILS"], "seccion" => $fields["SECCION"], "mail" => $fields["MAIL"]);
    }
}
$smarty->assign("mails", $aDatos);
// Render del template
$smarty->display('lista_mails.tpl');
Example #4
0
<?php

// Подключаем и инициализируем необходимые библиотеки
$Users = new Users(DB_PREFIX . DB_TBL_USERS);
$Friends = new Friends(DB_PREFIX . DB_TBL_FRIENDS);
$Avatars = new Avatars(DB_PREFIX . DB_TBL_AVATARS);
$Albums = new Albums(DB_PREFIX . DB_TBL_ALBUMS);
$Photos = new Photos(DB_PREFIX . DB_TBL_PHOTOS);
$Groups = new Groups(DB_PREFIX . DB_TBL_GROUPS);
$Mails = new Mails(DB_PREFIX . DB_TBL_MAILS);
$Walls = new Walls(DB_PREFIX . DB_TBL_WALLS);
$Topics = new Topics(DB_PREFIX . DB_TBL_TOPICS);
$Events = new Events(DB_PREFIX . DB_TBL_EVENTS);
$Bookmarks = new Bookmarks(DB_PREFIX . DB_TBL_BOOKMARKS);
include_once FLGR_LIBS . '/int.php';
/**
 * 
 */
//include_once(FLGR_COMMON.'/bread-crumbs.php');
if (isset($aRequest[1]) && 'cms' == $aRequest[1]) {
    $tplBreadCrumbs = new KTemplate();
    // надо оставлять чтобы конечные модули резетили шаблон $tplBreadCrumbs
    $BreadCrumbs = new BreadCrumbs();
    $BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
    // add breadcrumbs
} else {
    $BreadCrumbs = new BreadCrumbs('
		<!-- BEGIN BreadCrumbs -->
		<li><a href="{link}">{title}</a></li>
		<!-- END BreadCrumbs -->
	', '