本文整理汇总了PHP中Emails::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Emails::model方法的具体用法?PHP Emails::model怎么用?PHP Emails::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Emails
的用法示例。
在下文中一共展示了Emails::model方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
if (isset(Yii::app()->user->usIdent)) {
// Obtiene la clasificación de los equipos
$clasificacion = Clasificacion::model()->with('equipos')->findAll(array('order' => 'posicion ASC'));
Yii::app()->setParams(array('clasificacion' => $clasificacion));
// Obtiene la información del usuario
$usuario = Usuarios::model()->with('recursos')->findByPK(Yii::app()->user->usIdent);
Yii::app()->setParams(array('usuario' => $usuario));
// Obtiene la información de la mensajeria
//Saca la lista de los emails recibidos por el usuario y que ademas no los haya leido
$mensajeria = Emails::model()->findAllByAttributes(array('id_usuario_to' => Yii::app()->user->usIdent, 'leido' => 0));
$countmens = count($mensajeria);
Yii::app()->setParams(array('countmens' => $countmens));
// Obtiene la información de las notificaciones
//Saca la lista de las notinicaciones recibidas por el usuario y que ademas no haya leido
$notificaciones = Usrnotif::model()->findAllByAttributes(array('usuarios_id_usuario' => Yii::app()->user->usIdent, 'leido' => 0));
$countnot = count($notificaciones);
Yii::app()->setParams(array('countnot' => $countnot));
}
Yii::app()->setParams(array('bgclass' => 'bg-estadio-fuera'));
return true;
}
示例2: actionBackgroundProcess
/**
*
* @return String generated time
*/
public function actionBackgroundProcess()
{
$gentime = microtime();
$gentime = explode(' ', $gentime);
$gentime = $gentime[1] + $gentime[0];
$pg_start = $gentime;
// verify if are emails pending to send
$emails = Emails::model()->findAll(array('condition' => 't.email_status = 0', 'limit' => Yii::app()->params['mailSendMultiples']));
if (count($emails) > 0) {
foreach ($emails as $email) {
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
if ($mailer->Ready($email->email_subject, $email->email_body, array('email' => $email->email_toMail, 'name' => $email->email_toName), $email->email_priority)) {
$email->email_status = 1;
$email->email_sentDate = date("Y-m-d G:i:s");
$email->save(false);
}
}
}
$gentime = microtime();
$gentime = explode(' ', $gentime);
$gentime = $gentime[1] + $gentime[0];
$pg_end = $gentime;
$totaltime = $pg_end - $pg_start;
$showtime = number_format($totaltime, 4, '.', '');
echo "Generacion en " . $showtime . " segundos";
}
示例3: loadUpdateEmail
/**
* 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 loadUpdateEmail()
{
if ($this->_model === null) {
if (isset($_POST['ContactForm']['email'])) {
$condition = "email='" . $_POST['ContactForm']['email'] . "'";
$this->_model = Emails::model()->find($condition);
}
if ($this->_model === null) {
$this->_model = new Emails();
}
}
return $this->_model;
}
示例4: actionPendingMails
public function actionPendingMails()
{
// verify if are emails pending to send
$emails = Emails::model()->findAll(array('condition' => 't.email_status = 0', 'limit' => Yii::app()->params['mailSendMultiples']));
if (count($emails) > 0) {
foreach ($emails as $email) {
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
if ($mailer->Ready($email->email_subject, $email->email_body, array('email' => $email->email_toMail, 'name' => $email->email_toName), $email->email_priority)) {
$email->email_status = 1;
$email->email_sentDate = date("Y-m-d G:i:s");
$email->save(false);
}
}
}
}
示例5: loadModel
/**
* 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 Emails the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Emails::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例6: send_deffered_emails
public function send_deffered_emails()
{
$emails = Emails::model()->sending_round(self::EMAILS_COUNT)->findAll();
foreach ($emails as $email) {
if ($email->send()) {
$email->delete();
}
}
}
示例7: actionSendPendingEmails
/**
* Send pending emails
* Execute all minutes
* identificator 5
*/
public function actionSendPendingEmails()
{
$controlCronJobId = 5;
//Check control job
$control = ControlCronjobs::model()->findByPk($controlCronJobId);
//Check if status is 0 for to execute
if ($control->status == 0) {
$control->status = 1;
if ($control->save()) {
//Search all pending emails
$emails = Emails::model()->findAll('status = :status', array(':status' => Emails::STATUS_PENDING));
if (count($emails)) {
foreach ($emails as $email) {
if (Yii::app()->email->send('noreply@campeonatojustasmedievales.com', $email->destination, $email->title, $email->body, array($email->headers))) {
$email->status = Emails::STATUS_SENDED;
Yii::trace('[CRONJOBS][actionSendPendingEmails] email enviado.');
} else {
$email->status = Emails::STATUS_ERROR;
Yii::trace('[CRONJOBS][actionSendPendingEmails] No se puede enviar el email.', 'error');
}
$email->date = date('Y-m-d H:i:s');
if (!$email->save()) {
Yii::trace('[CRONJOBS][actionSendPendingEmails] No se puede actualizar el email a enviado', 'error');
}
}
}
//Free job
$control->status = 0;
if (!$control->save()) {
Yii::trace('[CRONJOBS][actionSendPendingEmails] No se ha podido salvar el control de proceso una vez finalizado.', 'warning');
}
} else {
Yii::trace('[CRONJOBS][actionSendPendingEmails] No se ha podido salvar el control de proceso.', 'warning');
}
} else {
Yii::trace('[CRONJOBS][actionSendPendingEmails] Hay otra ejecución en proceso.', 'warning');
}
}
示例8: actionSendEmails
public function actionSendEmails()
{
$emails = Emails::model()->findAll();
foreach($emails as $email) {
$this->sendMail($email->email);
}
}