/** * Fetch data to display the field value in mail * * @param Tracker_Artifact $artifact The artifact * @param Tracker_Artifact_ChangesetValue $value The actual value of the field * @param string $format output format * * @return string */ public function fetchMailArtifactValue(Tracker_Artifact $artifact, 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->getHTMLDisplayCrossRefs(true, false, false); } else { $output .= '<div>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'ref_list_empty') . '</div>'; } break; default: $refs = $crf->getMailCrossRefs('text'); $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; }