/**
  * Method used to send an alert to a set of email addresses when
  * a reminder action was triggered, but no action was really
  * taken because no recipients could be found.
  *
  * @access  private
  * @param   integer $issue_id The issue ID
  * @param   string $type Which reminder are we trying to send, email or sms
  * @param   array $reminder The reminder details
  * @param   array $action The action details
  * @return  void
  */
 function _recordNoRecipientError($issue_id, $type, $reminder, $action)
 {
     $to = Reminder::_getReminderAlertAddresses();
     if (count($to) > 0) {
         $tpl = new Template_API();
         $tpl->setTemplate('reminders/alert_no_recipients.tpl.text');
         $tpl->bulkAssign(array("type" => $type, "data" => $data, "reminder" => $reminder, "action" => $action, "conditions" => $conditions, "has_customer_integration" => Customer::hasCustomerIntegration(Issue::getProjectID($issue_id))));
         $text_message = $tpl->getTemplateContents();
         foreach ($to as $address) {
             // send email (use PEAR's classes)
             $mail = new Mail_API();
             $mail->setTextBody($text_message);
             $setup = $mail->getSMTPSettings();
             $mail->send($setup["from"], $address, "[#{$issue_id}] Reminder Not Triggered: " . $action['rma_title'], 0, $issue_id);
         }
     }
 }
示例#2
0
function getWeeklyReport($p)
{
    $email = XML_RPC_decode($p->getParam(0));
    $password = XML_RPC_decode($p->getParam(1));
    $auth = authenticate($email, $password);
    if (is_object($auth)) {
        return $auth;
    }
    $week = abs(XML_RPC_decode($p->getParam(2)));
    $start = XML_RPC_decode($p->getParam(3));
    $end = XML_RPC_decode($p->getParam(4));
    // we have to set a project so the template class works, even though the weekly report doesn't actually need it
    $projects = Project::getAssocList(Auth::getUserID());
    createFakeCookie($email, current(array_keys($projects)));
    // figure out the correct week
    if (empty($start) || empty($end)) {
        $start = date("U") - DAY * (date("w") - 1);
        if ($week > 0) {
            $start = $start - WEEK * $week;
        }
        $end = date("Y-m-d", $start + DAY * 6);
        $start = date("Y-m-d", $start);
    }
    $tpl = new Template_API();
    $tpl->setTemplate("reports/weekly_data.tpl.html");
    $tpl->assign("data", Report::getWeeklyReport(User::getUserIDByEmail($email), $start, $end));
    $ret = $tpl->getTemplateContents() . "\n";
    return new XML_RPC_Response(XML_RPC_Encode(base64_encode($ret)));
}
 /**
  * Method used to send the account details of an user.
  *
  * @access  public
  * @param   integer $usr_id The user ID
  * @return  void
  */
 function notifyAccountDetails($usr_id)
 {
     $info = User::getDetails($usr_id);
     $info["projects"] = Project::getAssocList($usr_id, true, true);
     // open text template
     $tpl = new Template_API();
     $tpl->setTemplate('notifications/account_details.tpl.text');
     $tpl->bulkAssign(array("app_title" => Misc::getToolCaption(), "user" => $info));
     $text_message = $tpl->getTemplateContents();
     // send email (use PEAR's classes)
     $mail = new Mail_API();
     $mail->setTextBody($text_message);
     $setup = $mail->getSMTPSettings();
     $mail->send($setup["from"], $mail->getFormattedName($info["usr_full_name"], $info["usr_email"]), APP_SHORT_NAME . ": Your User Account Details");
 }