本文整理汇总了PHP中Cake\Network\Email\Email::helpers方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::helpers方法的具体用法?PHP Email::helpers怎么用?PHP Email::helpers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Network\Email\Email
的用法示例。
在下文中一共展示了Email::helpers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendResetEmail
/**
* Sends reset email
*
* @param entity $user User entity.
*
* @return void
*/
public function sendResetEmail($user)
{
$reset_key = uniqid();
$user->{Configure::read('Lil.passwordResetField')} = $reset_key;
if ($this->save($user)) {
$email = new Email('default');
$email->from([Configure::read('Lil.from.email') => Configure::read('Lil.from.name')]);
$email->to($user->{Configure::read('Lil.userEmailField')});
$email->subject(__d('lil', 'Password Reset'));
$email->template('Lil.reset');
$email->emailFormat('text');
$email->viewVars(['reset_key' => $reset_key]);
$email->helpers(['Html']);
return $email->send();
}
return false;
}
示例2: sendunpaid
public function sendunpaid($sendto)
{
$this->loadModel('Payrolls');
$unpaid = $this->Payrolls->find()->contain(['Shows', 'Users'])->select(['id', 'date_worked', 'start_time', 'end_time', 'worked', 'is_paid', 'notes', 'showname' => 'Shows.name', 'fullname' => 'concat(Users.first, " ", Users.last)', 'activeshow' => 'Shows.is_active', 'Shows.end_date'])->where(['is_paid' => 0])->where(['Shows.is_active' => 1])->order(['Users.last' => 'ASC', 'Users.first' => 'ASC', 'Shows.end_date' => 'DESC', 'date_worked' => 'DESC', 'start_time' => 'DESC']);
$datatable = [];
$lastuser = "";
$subtotal = 0;
foreach ($unpaid as $item) {
if ($item->fullname != $lastuser) {
if ($subtotal > 0) {
$datatable[] = [$lastuser, '', 'Subtotal', '', '', '', number_format($subtotal, 2)];
$subtotal = 0;
}
$lastuser = $item->fullname;
}
$subtotal = $subtotal + $item->worked;
$datatable[] = [$item->fullname, $item->showname, $item->notes, $item->date_worked->i18nFormat('YYYY-MM-dd', 'UTC'), $item->start_time->i18nFormat('H:mm', 'UTC'), $item->end_time->i18nFormat('H:mm', 'UTC'), number_format($item->worked, 2)];
}
if ($subtotal > 0) {
$datatable[] = [$lastuser, '', 'Subtotal', '', '', '', number_format($subtotal, 2)];
}
$headers = ['User Name', 'Show Name', 'Notes', 'Date Worked', 'Start Time', 'End Time', 'Hours Worked'];
$email = new Email();
$email->transport('default');
$email->helpers(['Html', 'Gourmet/Email.Email']);
$email->emailFormat('both');
$email->to($sendto);
$email->subject('Unpaid Hours - ' . date('Y-m-d'));
$email->from('tdtracx@tdtrac.com');
$email->template('unpaid');
$email->viewVars(['headers' => $headers, 'tabledata' => $datatable]);
$email->send();
$this->verbose(' E-Mail Sent.');
}