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


PHP Writer::transformResponseValue方法代码示例

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


在下文中一共展示了Writer::transformResponseValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: transformResponseValue

 /**
  * Performs a transformation of the response value.
  * Reload the survey to use own value
  *
  * @param string $sValue
  * @param string $fieldType
  * @param FormattingOptions $oOptions
  * @param string $sColumn The name of the column
  * @return string
  */
 protected function transformResponseValue($sValue, $fieldType, FormattingOptions $oOptions, $sColumn = null)
 {
     static $aColumnDone = array();
     // If $sValue is already done for column :; we can take it again, but a lot of memory ....
     if ($this->exportAnswerPosition == 'aseperatecodetext') {
         if (!array_key_exists($sColumn, $aColumnDone)) {
             $bExportAnswerCode = !self::sameTextAndCode($fieldType, $sColumn);
             $bExportAnswerText = self::sameTextAndCode($fieldType, $sColumn);
             $aColumnDone[$sColumn] = 1;
         } else {
             $bExportAnswerCode = false;
             $bExportAnswerText = true;
             unset($aColumnDone[$sColumn]);
         }
     } else {
         $bExportAnswerCode = $this->exportAnswerCode && !self::sameTextAndCode($fieldType, $sColumn);
         $bExportAnswerText = $this->exportAnswerText || self::sameTextAndCode($fieldType, $sColumn);
     }
     $sAnswerFull = "";
     $sAnswerText = "";
     $sAnswerCode = "";
     $oSurvey = $this->oSurvey;
     // We need survey to get answers ...
     // New event to allow another plugin to do something
     $oEvent = new PluginEvent('exportCompleteAnswersTransformResponseValue');
     $oEvent->set('sValue', $sValue);
     $oEvent->set('fieldType', $fieldType);
     $oEvent->set('oOptions', $oOptions);
     // Needed ?
     $oEvent->set('oSurvey', $oSurvey);
     App()->getPluginManager()->dispatchEvent($oEvent);
     $sAnswerFull = $oEvent->get('answerValue');
     // if $sAnswerFull is done by plugin, return it
     if (null !== $sAnswerFull) {
         return $sAnswerFull;
     }
     if ($bExportAnswerCode) {
         if (is_null($sValue)) {
             $sAnswerCode = $this->codeStringForNull;
         } else {
             $sAnswerCode = Writer::transformResponseValue($sValue, $fieldType, $oOptions, $sColumn);
         }
         if ($sValue != "" || $sValue === "" && $this->exportNullEmptyAnswerCode != "notempty" || is_null($sValue) && $this->exportNullEmptyAnswerCode == "always") {
             if ($this->exportAnswerPosition != 'aseperatecodetext') {
                 $sAnswerCode = $this->exportAnswerCodeBefore . $sAnswerCode . $this->exportAnswerCodeAfter;
             }
         }
     }
     if ($bExportAnswerText) {
         if (is_null($sValue)) {
             $sAnswerText = $this->textStringForNull;
         } else {
             $sAnswerText = Writer::transformResponseValue($oSurvey->getFullAnswer($sColumn, $sValue, $this->translator, $this->languageCode), $fieldType, $oOptions, $sColumn);
         }
         // Remove not needed N/A ....
         $aNaType = array('Y', 'G', 'M', 'P');
         if (in_array($fieldType, $aNaType) && $sAnswerText == "N/A") {
             $sAnswerText = "";
         }
     }
     if ($this->exportAnswerPosition == 'acodetext') {
         $sAnswerFull = $sAnswerCode . $sAnswerText;
     } elseif ($this->exportAnswerPosition == 'atextcode') {
         $sAnswerFull = $sAnswerText . $sAnswerCode;
     }
     return $sAnswerFull;
 }
开发者ID:BelgianHealthCareKnowledgeCentre,项目名称:LS-exportCompleteAnswers,代码行数:77,代码来源:exportCompleteAnswersWriter.php


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