当前位置: 首页>>代码示例>>PHP>>正文


PHP Framework::warn方法代码示例

本文整理汇总了PHP中Framework::warn方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::warn方法的具体用法?PHP Framework::warn怎么用?PHP Framework::warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Framework的用法示例。


在下文中一共展示了Framework::warn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:33,代码来源:MailService.class.php

示例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.");
     }
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:67,代码来源:FormService.class.php

示例3: execute

 /**
  * @param block_BlockContext $context
  * @param block_BlockRequest $request
  * @return String the view name
  */
 public function execute($context, $request)
 {
     $id = $this->getFormId();
     if (empty($id)) {
         return block_BlockView::NONE;
     }
     $form = DocumentHelper::getDocumentInstance($id);
     if (!$form->isPublished()) {
         return block_BlockView::NONE;
     }
     $form->getDocumentNode()->getDescendents();
     $this->setParameter('form', $form);
     if ($context->inBackofficeMode()) {
         return block_BlockView::DUMMY;
     }
     if ($request->hasParameter("receiverIds")) {
         $receiverIds = explode(",", $request->getParameter("receiverIds"));
         $receiverLabels = array();
         foreach ($receiverIds as $receiverId) {
             if (is_numeric($receiverId)) {
                 try {
                     $receiver = DocumentHelper::getDocumentInstance($receiverId);
                     $receiverLabels[] = $receiver->getLabel();
                 } catch (Exception $e) {
                     Framework::exception($e);
                     $receiverLabels[] = $receiverId;
                 }
             } elseif (f_util_StringUtils::isNotEmpty($receiverId)) {
                 $receiverLabels[] = $receiverId;
             }
         }
         $this->setParameter("receiverLabels", $receiverLabels);
     }
     if ($this->isSuccess($context, $request)) {
         $view = block_BlockView::SUCCESS;
     } else {
         if ($this->isFormPosted($request)) {
             $fs = form_FormService::getInstance();
             try {
                 $fs->saveFormData($form, $request);
                 $user = $context->getGlobalContext()->getUser();
                 $user->setAttribute('form_success_parameters_' . $form->getId(), $request->getParameters());
                 $view = block_BlockView::SUCCESS;
             } catch (form_FormValidationException $e) {
                 $this->setParameter('errors', $e->getErrorCollection());
                 $view = block_BlockView::INPUT;
             }
         } else {
             $view = block_BlockView::INPUT;
         }
     }
     // Calls the BlockFormDecorator if present.
     $formId = $form->getFormid();
     $matches = null;
     if (preg_match('#^modules_([a-z]+)/([a-z]+)$#', $formId, $matches)) {
         $extendClassName = $matches[1] . '_BlockForm' . ucfirst($matches[2]) . 'Decorator';
         if (f_util_ClassUtils::classExists($extendClassName)) {
             $instance = new $extendClassName($this);
             if ($instance instanceof form_BlockFormDecorator) {
                 $instance->execute($context, $request);
             } else {
                 Framework::warn("\"{$extendClassName}\" is not an instance of \"block_BlockDecorator\": form \"{$formId}\" won't be decorated.");
             }
         }
     }
     return $view;
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:72,代码来源:BlockFormAction.class.php


注:本文中的Framework::warn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。