Пример #1
0
 /**
  * @param int $week
  * @param string $start
  * @param string $end
  * @param bool $separate_closed
  * @return string
  * @access protected
  * @deprecated use getWeeklyReportData() and format data yourself
  */
 public function getWeeklyReport($week, $start, $end, $separate_closed)
 {
     $usr_id = Auth::getUserID();
     $week = abs($week);
     // 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());
     $prj_id = current(array_keys($projects));
     AuthCookie::setProjectCookie($prj_id);
     $prj_id = Auth::getCurrentProject();
     // figure out the correct week
     if (empty($start) || empty($end)) {
         $start = date('U') - Date_Helper::DAY * (date('w') - 1);
         if ($week > 0) {
             $start = $start - Date_Helper::WEEK * $week;
         }
         $end = date('Y-m-d', $start + Date_Helper::DAY * 6);
         $start = date('Y-m-d', $start);
     }
     if ($separate_closed) {
         // emulate smarty value for reports/weekly_data.tpl.tmpl:
         // {if $smarty.post.separate_closed == 1}
         $_POST['separate_closed'] = true;
     }
     $options = array('separate_closed' => $separate_closed);
     $tpl = new Template_Helper();
     $tpl->setTemplate('reports/weekly_data.tpl.html');
     $tpl->assign(array('report_type' => 'weekly', 'data' => Report::getWeeklyReport($usr_id, $prj_id, $start, $end, $options)));
     $ret = $tpl->getTemplateContents() . "\n";
     return $ret;
 }
Пример #2
0
 /**
  * Method used to send a confirmation email to the user that is associated
  * to the email address.
  *
  * @param   string $usr_id The user ID
  * @return  void
  */
 public static function sendPasswordConfirmationEmail($usr_id)
 {
     $info = self::getDetails($usr_id);
     // send confirmation email to user
     $hash = md5($info['usr_full_name'] . $info['usr_email'] . Auth::privateKey());
     $tpl = new Template_Helper();
     $tpl->setTemplate('notifications/password_confirmation.tpl.text');
     $tpl->assign(array('app_title' => Misc::getToolCaption(), 'user' => $info, 'hash' => $hash));
     $text_message = $tpl->getTemplateContents();
     $setup = Setup::load();
     $mail = new Mail_Helper();
     // need to make this message MIME based
     $mail->setTextBody($text_message);
     $mail->send($setup['smtp']['from'], $info['usr_email'], APP_SHORT_NAME . ': New Password - Confirmation Required');
 }
Пример #3
0
 /**
  * Bounce message to sender.
  *
  * @param   object  $message parsed message structure.
  * @param   array   array(ERROR_CODE, ERROR_STRING) of error to bounce
  * @return  void
  */
 public function bounceMessage($message, $error)
 {
     // open text template
     $tpl = new Template_Helper();
     $tpl->setTemplate('notifications/bounced_email.tpl.text');
     $tpl->assign(array('error_code' => $error[0], 'error_message' => $error[1], 'date' => $message->date, 'subject' => Mime_Helper::fixEncoding($message->subject), 'from' => Mime_Helper::fixEncoding($message->fromaddress), 'to' => Mime_Helper::fixEncoding($message->toaddress), 'cc' => Mime_Helper::fixEncoding(@$message->ccaddress)));
     $sender_email = Mail_Helper::getEmailAddress($message->fromaddress);
     $usr_id = User::getUserIDByEmail($sender_email);
     // change the current locale
     if ($usr_id) {
         Language::set(User::getLang($usr_id));
     }
     $text_message = $tpl->getTemplateContents();
     // send email (use PEAR's classes)
     $mail = new Mail_Helper();
     $mail->setTextBody($text_message);
     $setup = $mail->getSMTPSettings();
     $mail->send($setup['from'], $sender_email, APP_SHORT_NAME . ': ' . ev_gettext('Postmaster notify: see transcript for details'));
     if ($usr_id) {
         Language::restore();
     }
 }
Пример #4
0
 public static function displayNotifiedUsers($notify_list)
 {
     if (count($notify_list) > 0) {
         $update_tpl = new Template_Helper();
         $update_tpl->setTemplate('include/notified_list.tpl.html');
         $update_tpl->assign('notify_list', $notify_list);
         self::setMessage($update_tpl->getTemplateContents(false), self::MSG_HTML_BOX);
     }
 }
Пример #5
0
        exit;
    } elseif ($res == 1) {
        Misc::setMessage(ev_gettext('Thank you, issue #%1$s was updated successfully.', $issue_id), Misc::MSG_INFO);
    }
    $notify_list = Notification::getLastNotifiedAddresses($issue_id);
    $has_duplicates = Issue::hasDuplicates($_POST['issue_id']);
    if ($has_duplicates || count($errors) > 0 || count($notify_list) > 0) {
        $update_tpl = new Template_Helper();
        $update_tpl->setTemplate('include/update_msg.tpl.html');
        $update_tpl->assign('update_result', $res);
        $update_tpl->assign('errors', $errors);
        $update_tpl->assign('notify_list', $notify_list);
        if ($has_duplicates) {
            $update_tpl->assign('has_duplicates', 'yes');
        }
        Misc::setMessage($update_tpl->getTemplateContents(false), Misc::MSG_HTML_BOX);
    }
    Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id);
    exit;
}
$prj_id = Auth::getCurrentProject();
// if currently selected release is in the past, manually add it to list
$releases = Release::getAssocList($prj_id);
if ($details['iss_pre_id'] != 0 && empty($releases[$details['iss_pre_id']])) {
    $releases = array($details['iss_pre_id'] => $details['pre_title']) + $releases;
}
if (Workflow::hasWorkflowIntegration($prj_id)) {
    $statuses = Workflow::getAllowedStatuses($prj_id, $issue_id);
    // if currently selected release is not on list, go ahead and add it.
} else {
    $statuses = Status::getAssocStatusList($prj_id, false);
 /**
  * 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.
  *
  * @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
  */
 private function _recordNoRecipientError($issue_id, $type, $reminder, $action, $data, $conditions)
 {
     $to = Reminder::_getReminderAlertAddresses();
     if (count($to) > 0) {
         $tpl = new Template_Helper();
         $tpl->setTemplate('reminders/alert_no_recipients.tpl.text');
         $tpl->assign(array('type' => $type, 'data' => $data, 'reminder' => $reminder, 'action' => $action, 'conditions' => $conditions, 'has_customer_integration' => CRM::hasCustomerIntegration(Issue::getProjectID($issue_id))));
         $text_message = $tpl->getTemplateContents();
         foreach ($to as $address) {
             // send email (use PEAR's classes)
             $mail = new Mail_Helper();
             $mail->setTextBody($text_message);
             $setup = $mail->getSMTPSettings();
             // TRANSLATORS: %1 = issue_id, %2 - rma_title
             $subject = ev_gettext('[#%1$s] Reminder Not Triggered: [#%2$s]', $issue_id, $action['rma_title']);
             $mail->send($setup['from'], $address, $subject, 0, $issue_id);
         }
     }
 }
Пример #7
0
 /**
  * Method used to send the account details of an user.
  *
  * @param   integer $usr_id The user ID
  * @return  void
  */
 public function notifyAccountDetails($usr_id)
 {
     $info = User::getDetails($usr_id);
     $info['projects'] = Project::getAssocList($usr_id, true, true);
     // open text template
     $tpl = new Template_Helper();
     $tpl->setTemplate('notifications/account_details.tpl.text');
     $tpl->assign(array('app_title' => Misc::getToolCaption(), 'user' => $info));
     Language::set(User::getLang($usr_id));
     $text_message = $tpl->getTemplateContents();
     // send email (use PEAR's classes)
     $mail = new Mail_Helper();
     $mail->setTextBody($text_message);
     $setup = $mail->getSMTPSettings();
     $to = $mail->getFormattedName($info['usr_full_name'], $info['usr_email']);
     // TRANSLATORS: %s = APP_SHORT_NAME
     $subject = ev_gettext('%s: Your User Account Details', APP_SHORT_NAME);
     $mail->send($setup['from'], $to, $subject);
     Language::restore();
 }