public function parsePromoter($objPromoter, $index = null, array $arrPromoters = array()) { $strTemplate = $this->cal_promoterTemplate ? $this->cal_promoterTemplate : 'cal_promoter_default'; $objT = new \FrontendTemplate($strTemplate); $objT->setData($objPromoter->row()); if ($objPromoter->room && ($objRoom = $objPromoter->getRelated('room')) !== null) { $objT->room = $objRoom; } $contact = new \stdClass(); $hasContact = false; if ($objPromoter->website) { $objT->websiteUrl = \HeimrichHannot\Haste\Util\Url::addScheme($objPromoter->website); } foreach (static::$arrContact as $strField) { if (!$objT->{$strField}) { continue; } $hasContact = true; $contact->{$strField} = $objT->{$strField}; } $objT->hasContact = $hasContact; $objT->contact = $contact; $objT->contactTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['contactTitle']; $objT->phoneTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['phoneTitle']; $objT->faxTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['faxTitle']; $objT->emailTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['emailTitle']; $objT->websiteTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['websiteTitle']; if (!empty($arrPromoters) && $index !== null) { $objT->cssClass = \HeimrichHannot\Haste\Util\Arrays::getListPositonCssClass($index, $arrPromoters); } return $objT->parse(); }
/** * @dataProvider getListPositonCssClassProvider * @test */ public function testGetListPositonCssClass($key, $arrList, $blnReturnAsArray, $expectedResult) { $this->assertSame($expectedResult, Arrays::getListPositonCssClass($key, $arrList, $blnReturnAsArray)); }