本文整理汇总了PHP中Framework::isWarnEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::isWarnEnabled方法的具体用法?PHP Framework::isWarnEnabled怎么用?PHP Framework::isWarnEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework::isWarnEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preSave
/**
* @param form_persistentdocument_mail $document
* @param Integer $parentNodeId Parent node ID where to save the document (optionnal => can be null !).
* @throws form_ReplyToFieldAlreadyExistsException
* @return void
*/
protected function preSave($document, $parentNodeId = null)
{
if ($document->getMultiline()) {
$document->setValidators('emails:true');
} else {
$document->setValidators('email:true');
}
if ($parentNodeId !== NULL) {
$form = DocumentHelper::getDocumentInstance($parentNodeId);
} else {
$form = $this->getFormOf($document);
}
if ($form === null) {
if (Framework::isWarnEnabled()) {
Framework::warn(__METHOD__ . ' the mail field document (' . $document->__toString() . ')is not in a form');
}
} else {
if ($document->getUseAsReply()) {
$oldReplyField = form_BaseFormService::getInstance()->getReplyToField($form);
if ($oldReplyField !== null && $oldReplyField !== $document) {
Framework::error(__METHOD__ . ' Old reply field :' . $oldReplyField->__toString());
throw new form_ReplyToFieldAlreadyExistsException(f_Locale::translate('&modules.form.bo.errors.Mail-field-for-replyto-exists'));
}
}
}
parent::preSave($document, $parentNodeId);
}
示例2: buildMessageRecipients
/**
* Builds the mail_MessageRecipients according to the recipients selected by
* the frontoffice user.
* This method may be overriden via the injection mechanism to allow the
* developper build a specific mail_MessageRecipients to suit the needs of
* the project.
*
* @param form_persistentdocument_form $form
* @param mail_MessageRecipients $recipients
* @param block_BlockRequest $request
*/
protected function buildMessageRecipients($form, &$recipients, &$request)
{
// If there is no recipientGroup, we can exit this method.
if ($form->getRecipientGroupCount() == 0) {
return;
}
// Init arrays.
$toArray = $recipients->hasTo() ? $recipients->getTo() : array();
$ccArray = $recipients->hasCC() ? $recipients->getCC() : array();
$bccArray = $recipients->hasBCC() ? $recipients->getBCC() : array();
// The following holds the ID of the recipientGroups selected by the user.
$selectedGroupArray = array();
// Retrieve the recipientGroups selected by the user.
// Depending on the selection type (single or multiple), this value may
// be either a string or an array.
if ($request->hasParameter(self::RECIPIENT_GROUP_FIELD_NAME)) {
$selectedGroupIds = $request->getParameter(self::RECIPIENT_GROUP_FIELD_NAME);
if (is_string($selectedGroupIds)) {
$selectedGroupIds = array($selectedGroupIds);
}
// Convert each value into an integer.
$selectedGroupIds = array_map('intval', $selectedGroupIds);
foreach ($form->getRecipientGroupArray() as $recipientGroup) {
if (in_array($recipientGroup->getId(), $selectedGroupIds)) {
$selectedGroupArray[] = $recipientGroup;
}
}
// If the form holds more than one recipientGroups and if the request
// contains no recipientGroup selection, we throw an Exception.
if (count($selectedGroupArray) == 0) {
throw new form_FormException('Unable to determine the recipients.');
}
} else {
$selectedGroupArray = $form->getRecipientGroupArray();
}
// Iterates over the form's recipientGroups and skip the ones that have
// not been selected by the user.
foreach ($selectedGroupArray as $recipientGroup) {
foreach ($recipientGroup->getToArray() as $contact) {
$toArray = array_merge($toArray, $contact->getEmailAddresses());
}
foreach ($recipientGroup->getCcArray() as $contact) {
$ccArray = array_merge($ccArray, $contact->getEmailAddresses());
}
foreach ($recipientGroup->getBccArray() as $contact) {
$bccArray = array_merge($bccArray, $contact->getEmailAddresses());
}
}
// Update mail_MessageRecipients object.
$recipients->setTo(array_unique($toArray));
$recipients->setCC(array_unique($ccArray));
$recipients->setBCC(array_unique($bccArray));
if ($recipients->isEmpty() && Framework::isWarnEnabled()) {
Framework::warn(__METHOD__ . " recipients is empty.");
}
}