本文整理汇总了PHP中Note::insertNote方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::insertNote方法的具体用法?PHP Note::insertNote怎么用?PHP Note::insertNote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::insertNote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Note
$pk_id_evaluations_set = $eval->getEvaluationsSettingsId(array($opcion, 1));
$pk_id_evaluations_set2 = $eval->getEvaluationsSettingsId(array($opcion, 2));
break;
case 2:
$pk_id_evaluations_set = $eval->getEvaluationsSettingsId(array($opcion, 4));
$pk_id_evaluations_set2 = $eval->getEvaluationsSettingsId(array($opcion, 5));
break;
case 3:
$pk_id_evaluations_set = $eval->getEvaluationsSettingsId(array($opcion, 7));
$pk_id_evaluations_set2 = $eval->getEvaluationsSettingsId(array($opcion, 8));
break;
}
$note = new Note($db);
$data_note = array($datos[7], null, $id_ballot, $pk_id_evaluations_set, $id_matter);
$data_note2 = array($datos[8], null, $id_ballot, $pk_id_evaluations_set2, $id_matter);
$id_note = $note->insertNote($data_note, $idTransaction);
$id_note2 = $note->insertNote($data_note2, $idTransaction);
//adicionar la confirmacion o error del insert
//adicionar registro de los logs
$res = $id_note;
//resultado final
break;
}
$contador = $contador + 1;
}
if ($res > 0) {
$msg = "<br>Total Registros Cargados: " . $contador;
Forms::setMessage('SUCCESS', $v_label["SHORT_MESSAGE_OK_UPLOAD"], $v_label["DETAIL_MESSAGE_OK_UPLOAD"] . $msg);
} else {
Forms::setMessage('ERROR', $v_label["SHORT_MESSAGE_NOOK_UPLOAD"], $v_label["DETAIL_MESSAGE_NOOK_UPLOAD"]);
}
示例2: sendEmail
/**
* TODO: merge use of $options and $email arrays to just $email
*
* @param int $issue_id
* @param string $type type of email
* @param string $from
* @param string $to
* @param string $cc
* @param string $subject
* @param string $body
* @param array $options optional parameters
* - (int) parent_sup_id
* - (array) iaf_ids attachment file ids
* - (bool) add_unknown
* - (int) ema_id
* @return int 1 if it worked, -1 otherwise
*/
public static function sendEmail($issue_id, $type, $from, $to, $cc, $subject, $body, $options = array())
{
$parent_sup_id = $options['parent_sup_id'];
$iaf_ids = $options['iaf_ids'];
$add_unknown = $options['add_unknown'];
$ema_id = $options['ema_id'];
$current_usr_id = Auth::getUserID();
$prj_id = Issue::getProjectID($issue_id);
// if we are replying to an existing email, set the In-Reply-To: header accordingly
$in_reply_to = $parent_sup_id ? self::getMessageIDByID($parent_sup_id) : false;
// get ID of whoever is sending this.
$sender_usr_id = User::getUserIDByEmail(Mail_Helper::getEmailAddress($from)) ?: false;
// remove extra 'Re: ' from subject
$subject = Mail_Helper::removeExcessRe($subject, true);
$internal_only = false;
$message_id = Mail_Helper::generateMessageID();
// process any files being uploaded
// from ajax upload, attachment file ids
if ($iaf_ids) {
// FIXME: is it correct to use sender from post data?
$attach_usr_id = $sender_usr_id ?: $current_usr_id;
Attachment::attachFiles($issue_id, $attach_usr_id, $iaf_ids, false, 'Attachment originated from outgoing email');
}
// hack needed to get the full headers of this web-based email
$full_email = self::buildFullHeaders($issue_id, $message_id, $from, $to, $cc, $subject, $body, $in_reply_to, $iaf_ids);
// email blocking should only be done if this is an email about an associated issue
if ($issue_id) {
$user_info = User::getNameEmail($current_usr_id);
// check whether the current user is allowed to send this email to customers or not
if (!self::isAllowedToEmail($issue_id, $user_info['usr_email'])) {
// add the message body as a note
$note = Mail_Helper::getCannedBlockedMsgExplanation() . $body;
$note_options = array('full_message' => $full_email, 'is_blocked' => true);
Note::insertNote($current_usr_id, $issue_id, $subject, $note, $note_options);
$email_details = array('from' => $from, 'to' => $to, 'cc' => $cc, 'subject' => $subject, 'body' => &$body, 'message' => &$body, 'title' => $subject);
Workflow::handleBlockedEmail($prj_id, $issue_id, $email_details, 'web');
return 1;
}
}
// only send a direct email if the user doesn't want to add the Cc'ed people to the notification list
if (($add_unknown || Workflow::shouldAutoAddToNotificationList($prj_id)) && $issue_id) {
// add the recipients to the notification list of the associated issue
$recipients = array($to);
$recipients = array_merge($recipients, self::getRecipientsCC($cc));
foreach ($recipients as $address) {
if ($address && !Notification::isIssueRoutingSender($issue_id, $address)) {
$actions = Notification::getDefaultActions($issue_id, $address, 'add_unknown_user');
Notification::subscribeEmail($current_usr_id, $issue_id, Mail_Helper::getEmailAddress($address), $actions);
}
}
} else {
// Usually when sending out emails associated to an issue, we would
// simply insert the email in the table and call the Notification::notifyNewEmail() method,
// but on this case we need to actually send the email to the recipients that are not
// already in the notification list for the associated issue, if any.
// In the case of replying to an email that is not yet associated with an issue, then
// we are always directly sending the email, without using any notification list
// functionality.
if ($issue_id) {
// send direct emails only to the unknown addresses, and leave the rest to be
// catched by the notification list
$from = Notification::getFixedFromHeader($issue_id, $from, 'issue');
// build the list of unknown recipients
if ($to) {
$recipients = array($to);
$recipients = array_merge($recipients, self::getRecipientsCC($cc));
} else {
$recipients = self::getRecipientsCC($cc);
}
$unknowns = array();
foreach ($recipients as $address) {
if (!Notification::isSubscribedToEmails($issue_id, $address)) {
$unknowns[] = $address;
}
}
if ($unknowns) {
$to2 = array_shift($unknowns);
$cc2 = implode('; ', $unknowns);
// send direct emails
self::sendDirectEmail($issue_id, $from, $to2, $cc2, $subject, $body, $_FILES['attachment'], $message_id, $sender_usr_id);
}
} else {
// send direct emails to all recipients, since we don't have an associated issue
//.........这里部分代码省略.........
示例3: blockEmailIfNeeded
/**
* Check if this email needs to be blocked and if so, block it.
*/
public static function blockEmailIfNeeded($email)
{
if (empty($email['issue_id'])) {
return false;
}
$issue_id = $email['issue_id'];
$prj_id = Issue::getProjectID($issue_id);
$sender_email = strtolower(Mail_Helper::getEmailAddress($email['from']));
list($text_headers, $body) = Mime_Helper::splitHeaderBody($email['full_email']);
if (Mail_Helper::isVacationAutoResponder($email['headers']) || Notification::isBounceMessage($sender_email) || !self::isAllowedToEmail($issue_id, $sender_email)) {
// add the message body as a note
// avoid having this type of message re-open the issue
if (Mail_Helper::isVacationAutoResponder($email['headers'])) {
$closing = true;
$notify = false;
} else {
$closing = false;
$notify = true;
}
$options = array('unknown_user' => $email['headers']['from'], 'log' => false, 'closing' => $closing, 'send_notification' => $notify, 'is_blocked' => true, 'full_message' => $email['full_email'], 'message_id' => Mail_Helper::getMessageID($text_headers, $body));
$body = Mail_Helper::getCannedBlockedMsgExplanation() . $email['body'];
$res = Note::insertNote(Auth::getUserID(), $issue_id, @$email['headers']['subject'], $body, $options);
// associate the email attachments as internal-only files on this issue
if ($res != -1) {
self::extractAttachments($issue_id, $email['full_email'], true, $res);
}
$email_details = array();
$email_details['issue_id'] = $issue_id;
$email_details['from'] = $sender_email;
// XXX: review and remove unneeded ones
// these are from 01c7db33
$email_details['full_message'] = $email['full_email'];
$email_details['title'] = @$email['headers']['subject'];
$email_details['note'] = $body;
$email_details['message_id'] = $options['message_id'];
// avoid having this type of message re-open the issue
if (Mail_Helper::isVacationAutoResponder($email['headers'])) {
$email_type = 'vacation-autoresponder';
} else {
$email_type = 'routed';
}
Workflow::handleBlockedEmail($prj_id, $issue_id, $email_details, $email_type);
// try to get usr_id of sender, if not, use system account
$usr_id = User::getUserIDByEmail(Mail_Helper::getEmailAddress($email['from']), true);
if (!$usr_id) {
$usr_id = APP_SYSTEM_USER_ID;
}
History::add($issue_id, $usr_id, 'email_blocked', "Email from '{from}' blocked", array('from' => $email['from']));
return true;
}
return false;
}