@@ -168,15 +168,34 @@ public function sendEmail($params)
168
168
$ producerDao = $ trendDao ->getProducer ();
169
169
$ fullUrl = UtilityComponent::getServerURL ().$ this ->webroot ;
170
170
$ email = $ userDao ->getEmail ();
171
- $ subject = 'Tracker Dashboard Threshold Notification ' ;
171
+
172
+ $ producerName = $ producerDao ->getDisplayName ();
173
+ $ trendName = $ trendDao ->getDisplayName ();
174
+ $ thresholdValue = $ notification ['value ' ];
175
+ $ thresholdComparison = $ notification ['comparison ' ];
176
+ $ scalarValue = $ scalar ['value ' ];
177
+ $ subject = 'Threshold Alert: ' . $ producerName . ': ' . $ trendName . ' value ' . $ scalarValue . ' ' . $ thresholdComparison . ' ' . $ thresholdValue ;
178
+
172
179
$ body = 'Hello,<br/><br/>This email was sent because a submitted scalar value exceeded a threshold that you specified.<br/><br/> ' ;
173
180
$ body .= '<b>Community:</b> <a href=" ' .$ fullUrl .'/community/ ' .$ producerDao ->getCommunityId (
174
181
).'"> ' .htmlspecialchars ($ producerDao ->getCommunity ()->getName (), ENT_QUOTES , 'UTF-8 ' ).'</a><br/> ' ;
175
182
$ body .= '<b>Producer:</b> <a href=" ' .$ fullUrl .'/ ' .$ this ->moduleName .'/producer/view?producerId= ' .$ producerDao ->getKey (
176
183
).'"> ' .htmlspecialchars ($ producerDao ->getDisplayName (), ENT_QUOTES , 'UTF-8 ' ).'</a><br/> ' ;
177
184
$ body .= '<b>Trend:</b> <a href=" ' .$ fullUrl .'/ ' .$ this ->moduleName .'/trend/view?trendId= ' .$ trendDao ->getKey (
178
185
).'"> ' .htmlspecialchars ($ trendDao ->getDisplayName (), ENT_QUOTES , 'UTF-8 ' ).'</a><br/> ' ;
179
- $ body .= '<b>Value:</b> ' .htmlspecialchars ($ scalar ['value ' ], ENT_QUOTES , 'UTF-8 ' );
186
+ $ body .= 'Visit the above Trend link to change or disable notifications.<br/> ' ;
187
+ $ body .= '<b>Value:</b> ' .htmlspecialchars ($ scalarValue , ENT_QUOTES , 'UTF-8 ' ).'<br/> ' ;
188
+ $ body .= '<b>Threshold:</b> ' .htmlspecialchars ($ thresholdComparison , ENT_QUOTES , 'UTF-8 ' ).' ' .htmlspecialchars ($ thresholdValue , ENT_QUOTES , 'UTF-8 ' ).'<br/> ' ;
189
+
190
+ // Add gmail "View Action".
191
+ $ trendTrackerUrl = $ fullUrl .'/ ' .$ this ->moduleName .'/trend/view?trendId= ' .$ trendDao ->getKey ();
192
+ $ body .= '<div itemscope itemtype="http://schema.org/EmailMessage"> ' ;
193
+ $ body .= ' <div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction"> ' ;
194
+ $ body .= ' <link itemprop="target" href=" ' .$ trendTrackerUrl .'"/> ' ;
195
+ $ body .= ' <meta itemprop="name" content="View trend plot"/> ' ;
196
+ $ body .= ' </div> ' ;
197
+ $ body .= ' <meta itemprop="description" content="View the trend plot"/> ' ;
198
+ $ body .= '</div> ' ;
180
199
181
200
Zend_Registry::get ('notifier ' )->callback (
182
201
'CALLBACK_CORE_SEND_MAIL_MESSAGE ' ,
0 commit comments