5-2-1
產生通知信內容
您沒有觀看影片的權限
請先登入,登入後,確認您的權限後,即可觀看影片。
- 先粗略的產生信件內容,暫時以取消報名為例 影片中第 9 行原為 self::get($id, true);,請將第二個參數 true 刪除
// 產生通知信
public static function mail($id, $type, $signup = [])
{
global $xoopsUser;
$id = (int) $id;
if (empty($id)) {
redirect_header($_SERVER['PHP_SELF'], 3, "無編號,無法寄送通知信");
}
$signup = $signup ? $signup : self::get($id);
$now = date("Y-m-d H:i:s");
$name = $xoopsUser->name();
$name = $name ? $name : $xoopsUser->uname();
$action = Tad_signup_actions::get($signup['action_id']);
$member_handler = xoops_getHandler('member');
$admUser = $member_handler->getUser($action['uid']);
$adm_email = $admUser->email();
if ($type == 'destroy') {
$title = "「{$action['title']}」取消報名通知";
$content = "<p>您於 {$signup['signup_date']} 報名了「{$action['title']}」活動已於 {$now} 由 {$name} 取消報名。</p>";
$content .= "欲重新報名,請連至 " . XOOPS_URL . "/modules/tad_signup/index.php?op=tad_signup_data_create&action_id={$action['id']}";
}
if (!self::send($title, $content, $email)) {
redirect_header($_SERVER['PHP_SELF'], 3, "通知信寄發失敗!");
}
self::send($title, $content, $adm_email);
}
link to https://github.com/tadlearn/tad_signup/commit/e8f1d07723e281a987a9bc07db3b21e6fc4779d7 \