/** * Sets a link to the campaign statistics if it contains sent mailings * * @param int $id The ID of the campaign. * @return string */ public static function setStatisticsLink($id) { // build the link HTML $html = '<a href="' . BackendModel::createURLForAction('statistics_campaign') . '&id=' . $id . '" class="button icon iconStats linkButton"><span>' . BL::lbl('Statistics') . '</span></a>'; // check if this campaign has sent mailings $hasSentMailings = BackendMailmotorModel::existsSentMailingsByCampaignID($id) > 0 ? true : false; // return the result return $hasSentMailings ? $html : ''; }