/**
  * Fetch data to display the field value in mail
  *
  * @param Tracker_Artifact                $artifact         The artifact
  * @param PFUser                          $user             The user who will receive the email
  * @param Tracker_Artifact_ChangesetValue $value            The actual value of the field
  * @param string                          $format           output format
  *
  * @return string
  */
 public function fetchMailArtifactValue(Tracker_Artifact $artifact, PFUser $user, Tracker_Artifact_ChangesetValue $value = null, $format = 'text')
 {
     $output = '';
     $crf = new CrossReferenceFactory($artifact->getId(), Tracker_Artifact::REFERENCE_NATURE, $this->getTracker()->getGroupId());
     $crf->fetchDatas();
     switch ($format) {
         case 'html':
             if ($crf->getNbReferences()) {
                 $output .= $crf->getHTMLCrossRefsForMail();
             } else {
                 $output .= '-';
             }
             break;
         default:
             $refs = $crf->getFormattedCrossReferences();
             $src = '';
             $tgt = '';
             $both = '';
             $output = PHP_EOL;
             if (!empty($refs['target'])) {
                 foreach ($refs['target'] as $refTgt) {
                     $tgt .= $refTgt['ref'];
                     $tgt .= PHP_EOL;
                     $tgt .= $refTgt['url'];
                     $tgt .= PHP_EOL;
                 }
                 $output .= ' -> Target : ' . PHP_EOL . $tgt;
                 $output .= PHP_EOL;
             }
             if (!empty($refs['source'])) {
                 foreach ($refs['source'] as $refSrc) {
                     $src .= $refSrc['ref'];
                     $src .= PHP_EOL;
                     $src .= $refSrc['url'];
                     $src .= PHP_EOL;
                 }
                 $output .= ' -> Source : ' . PHP_EOL . $src;
                 $output .= PHP_EOL;
             }
             if (!empty($refs['both'])) {
                 foreach ($refs['both'] as $refBoth) {
                     $both .= $refBoth['ref'];
                     $both .= PHP_EOL;
                     $both .= $refBoth['url'];
                     $both .= PHP_EOL;
                 }
                 $output .= ' -> Both   : ' . PHP_EOL . $both;
                 $output .= PHP_EOL;
             }
             break;
     }
     return $output;
 }