<?php
class HomeWebApp_View_Helper_TrackBackHeadUrl
{
    public function trackBackheadUrl(Blog_Model_TrackBackEntry $trackBack)
    {
        $blogName = MKLib_Utils::niceTruncate($trackBack->getBlogName(),10);

        $wholeTitle = empty($blogName) ? "" : $blogName;

        $title = MKLib_Utils::niceTruncate($trackBack->getTitle(),20);

        if (!empty($wholeTitle)) {
            $wholeTitle .= empty($title) ? "" : " - " . $title;
        } else {
            $wholeTitle =$title;
        }

        $finalUrl ="<a href=\"".$trackBack->getUrl()."\">"
            . (empty($wholeTitle) ? "some trackback": $wholeTitle)
            . "</a>";

        return $finalUrl;
    }
}
