当前位置: 首页>>代码示例>>PHP>>正文


PHP Newsletter::model方法代码示例

本文整理汇总了PHP中Newsletter::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Newsletter::model方法的具体用法?PHP Newsletter::model怎么用?PHP Newsletter::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Newsletter的用法示例。


在下文中一共展示了Newsletter::model方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doJob

 protected function doJob($arg)
 {
     $models = Newsletter::model()->findAll(array('condition' => 't.remain_subscribers IS NOT NULL AND length(t.remain_subscribers) > 0 AND t.send_time <= NOW()', 'order' => 't.id ASC'));
     foreach ($models as $model) {
         $mail_models = ProNewsletterMail::model()->findAll(array('condition' => 't.newsletter_id = ' . $model->id, 'order' => 't.id ASC'));
         if (count($mail_models)) {
             $receivers = explode(',', $model->remain_subscribers);
             $subscriber_count = 0;
             foreach ($mail_models as $key => $k) {
                 $revei = array_shift($receivers);
                 // need update this field
                 $s = Subscriber::model()->getSubscriberByEmail($k->email);
                 if (empty($s)) {
                     continue;
                 }
                 if ($s) {
                     if ($s->status == 0) {
                         continue;
                     }
                 }
                 // add by Nguyen Dung
                 $url = Yii::app()->setting->getItem('server_name') . '/site/track_newsletter?newsletter_id=' . $model->id . '&subscriber_email=' . $s->email;
                 $img_track_read_email = '<img src="' . $url . '" alt="" height="1" width="1"/>';
                 $r = array('subject' => $model->subject, 'params' => array('content' => $model->content . $img_track_read_email, 'newsletterName' => Yii::app()->params['title'], 'unsubscribe' => Yii::app()->setting->getItem('server_name') . '/site/unsubscribe?id=' . $s->id . '&code=' . md5($s->id . $s->email)), 'view' => 'newsletter', 'to' => $s->email, 'from' => Yii::app()->params['autoEmail']);
                 $this->data[] = $r;
                 //Delete record in newsletter mail
                 ProNewsletterMail::model()->deleteByPk($k->id);
                 $subscriber_count++;
                 //count subscriber is served for current newsletter job
                 $this->index++;
                 //count email is sent for current cron job
                 if ($this->index >= $this->max) {
                     break;
                 }
             }
             $model->total_sent = $model->total_sent + $subscriber_count;
             // track amount mail sent
             $model->remain_subscribers = implode(',', $receivers);
             $model->update(array('remain_subscribers', 'total_sent'));
         }
     }
     //when sent all subscriber of a newsletter job but the
     //        if($this->index < $this->max)
     //            $this->doJob($arg);
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:45,代码来源:NewsletterCommand.php

示例2: loadModel

 /**
  * @param integer the ID of the model to be loaded
  * @return 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.
  */
 public function loadModel($id)
 {
     $model = Newsletter::model()->findByPk($id);
     if ($model === null) {
         Yii::log('The requested page does not exist.');
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:14,代码来源:NewsletterController.php

示例3: actiondelete

 /**
  * Delete an item
  */
 public function actiondelete()
 {
     if (isset($_GET['id']) && ($model = Newsletter::model()->findByPk($_GET['id']))) {
         $model->delete();
         Yii::app()->user->setFlash('success', Yii::t('newsletter', 'Item Deleted.'));
         $this->redirect(array('index'));
     } else {
         $this->redirect(array('index'));
     }
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:13,代码来源:NewsletterController.php

示例4: array

<h1>Newsletters</h1>

<b><p>Eventos Para Newsletter</p></b>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'dataProvider'=>$data,
	'columns'=>array(
            'titulo',
            'dtinicio',
            'dtfim'
        )
)); ?>

<?php

$this->renderPartial('_form',array('model'=>  Newsletter::model()));

?>
开发者ID:rafaelumlei,项目名称:EngenhariaWeb,代码行数:17,代码来源:index.php

示例5: getNewsletterByPk

 public static function getNewsletterByPk($pk)
 {
     return Newsletter::model()->findByPk((int) $pk);
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:4,代码来源:Newsletter.php

示例6:

					<td><?php 
echo Yii::t('adminindex', 'Number Of Users');
?>
</td>
					<td><?php 
echo Yii::app()->format->number(Members::model()->count());
?>
</td>
				</tr>
				<tr>
					<td><?php 
echo Yii::t('adminindex', 'Newsletter Signups');
?>
</td>
					<td><?php 
echo Yii::app()->format->number(Newsletter::model()->count());
?>
</td>
				</tr>
				<tr>
					<td><?php 
echo Yii::t('adminindex', 'Last Registered');
?>
</td>
					<td><?php 
echo Members::model()->find(array('order' => 'joined desc', 'limit' => 1))->getModelLink();
?>
</td>
				</tr>
				<tr>
					<td><?php 
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:31,代码来源:index.php


注:本文中的Newsletter::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。