Beispiel #1
0
 private function _workerAssignedTask($event)
 {
     $translate = DevblocksPlatform::getTranslationService();
     $events = DevblocksPlatform::getEventService();
     $worker_id = $event->params['worker_id'];
     $context = $event->params['context'];
     $task_id = $event->params['context_id'];
     $mail_service = DevblocksPlatform::getMailService();
     $mailer = null;
     // lazy load
     $settings = DevblocksPlatform::getPluginSettingsService();
     $reply_to = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM, CerberusSettingsDefaults::DEFAULT_REPLY_FROM);
     $reply_personal = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_PERSONAL, CerberusSettingsDefaults::DEFAULT_REPLY_PERSONAL);
     $task = DAO_Task::get($task_id);
     // Sanitize and combine all the destination addresses
     $next_worker = DAO_Worker::get($worker_id);
     $notify_emails = $next_worker->email;
     if (empty($notify_emails)) {
         return;
     }
     try {
         if (null == $mailer) {
             $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults());
         }
         // Create the message
         $mail = $mail_service->createMessage();
         $mail->setTo(array($notify_emails));
         $mail->setFrom(array($reply_to => $reply_personal));
         $mail->setReplyTo($reply_to);
         $mail->setSubject(sprintf("[Task Assignment #%d]: %s", $task->id, $task->title));
         $headers = $mail->getHeaders();
         $headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')');
         $headers->addTextHeader('Precedence', 'List');
         $headers->addTextHeader('Auto-Submitted', 'auto-generated');
         $body = sprintf("[Task Assignment #%d]: %s", $task->id, $task->title);
         $mft = DevblocksPlatform::getExtension($context, false, true);
         $ext = $mft->createInstance();
         $url = $ext->getPermalink($task_id);
         $body .= "\r\n" . $url;
         // Comments
         $comments = DAO_Comment::getByContext(CerberusContexts::CONTEXT_TASK, $task_id);
         foreach ($comments as $comment_id => $comment) {
             $address = DAO_Address::get($comment->address_id);
             $body .= "\r\nCommented By: " . $address->first_name . " " . $address->last_name;
             $body .= "\r\n" . $comment->comment;
         }
         unset($comments);
         $body .= "\r\n";
         $mail->setBody($body);
         $result = $mailer->send($mail);
     } catch (Exception $e) {
         echo "Task Email Notification failed to send<br>";
     }
 }
Beispiel #2
0
 function showWorkerPeekAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $tpl->assign('view_id', $view_id);
     $worker = DAO_Worker::get($id);
     $tpl->assign('worker', $worker);
     // Custom Fields
     $custom_fields = DAO_CustomField::getBySource(FegCustomFieldSource_Worker::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(FegCustomFieldSource_Worker::ID, $id);
     if (isset($custom_field_values[$id])) {
         $tpl->assign('custom_field_values', $custom_field_values[$id]);
     }
     $tpl->display('file:' . $this->_TPL_PATH . 'setup/tabs/workers/peek.tpl');
 }