本文整理汇总了PHP中FrontendTemplate::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendTemplate::setData方法的具体用法?PHP FrontendTemplate::setData怎么用?PHP FrontendTemplate::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontendTemplate
的用法示例。
在下文中一共展示了FrontendTemplate::setData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseMap
public function parseMap()
{
$objT = new \FrontendTemplate($this->strTemplate);
$objT->setData($GLOBALS['TL_LANG']['imagemapster']);
$objT->active = $this->active;
return $objT->parse();
}
示例2: parseJs
protected function parseJs()
{
$objT = new \FrontendTemplate($this->strTemplate);
$objT->setData($this->arrData);
$objT->id = '#ctrl_' . $this->strName;
return $objT->parse();
}
示例3: parseCredit
protected function parseCredit($objItem)
{
global $objPage;
$objCredit = new FileCreditHybridModel();
$objCredit = $objCredit->findRelatedByCredit($objItem, $this->arrPids);
if (is_null($objCredit)) {
return null;
}
$objTemplate = new \FrontendTemplate('filecredit_default');
$objTemplate->setData($objCredit->file->row());
// TODO
$objTemplate->link = $this->generateCreditUrl($objCredit);
$objTemplate->linkText = $GLOBALS['TL_LANG']['MSC']['creditLinkText'];
// TODO
if ($objCredit->page === null && $objCredit->result->usage) {
$objTemplate->pageTitle = $objCredit->result->usage;
} else {
$objTemplate->pageTitle = $objCredit->page->pageTitle ? $objCredit->page->pageTitle : $objCredit->page->title;
}
// colorbox support
if ($objPage->outputFormat == 'xhtml') {
$strLightboxId = 'lightbox';
} else {
$strLightboxId = 'lightbox[' . substr(md5($objTemplate->getName() . '_' . $objCredit->file->id), 0, 6) . ']';
}
$objTemplate->attribute = $strLightboxId ? ($objPage->outputFormat == 'html5' ? ' data-gallery="#gallery-' . $this->id . '" data-lightbox="' : ' rel="') . $strLightboxId . '"' : '';
return $objTemplate->parse();
}
示例4: compile
/**
* Generate module
*/
protected function compile()
{
// Get ID
$strAlias = \Input::get('auto_item') ? \Input::get('auto_item') : \Input::get('store');
// Find published store from ID
if (($objStore = AnyStoresModel::findPublishedByIdOrAlias($strAlias)) !== null) {
// load all details
$objStore->loadDetails();
// generate description
$objDescription = \ContentModel::findPublishedByPidAndTable($objStore->id, $objStore->getTable());
if ($objDescription !== null) {
while ($objDescription->next()) {
$objStore->description .= \Controller::getContentElement($objDescription->current());
}
}
// Get referer for back button
$objStore->referer = $this->getReferer();
// generate google map if template and geodata is set
if ($this->anystores_mapTpl != '' && is_numeric($objStore->latitude) && is_numeric($objStore->longitude)) {
$objMapTemplate = new \FrontendTemplate($this->anystores_mapTpl);
$objMapTemplate->setData($objStore->row());
$objStore->gMap = $objMapTemplate->parse();
}
// Template
$objDetailTemplate = new \FrontendTemplate($this->anystores_detailTpl);
$objDetailTemplate->setData($objStore->row());
$this->Template->store = $objDetailTemplate->parse();
} else {
$this->_redirect404();
}
}
示例5: parsePromoter
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();
}
示例6: parseCredit
public static function parseCredit(FileCreditModel $objModel, array $arrPids = array(), $objModule)
{
global $objPage;
$objTemplate = new \FrontendTemplate(!$objModule->creditsGroupBy ? 'filecredit_default' : 'filecredit_grouped');
// skip if no files model exists
if (($objFilesModel = $objModel->getRelated('uuid')) === null) {
return null;
}
// cleanup: remove credits where copyright was deleted
if ($objFilesModel->copyright == '') {
FileCreditPageModel::deleteByPid($objModel->id);
$objModel->delete();
return null;
}
// skip if credit occurs on no page
if (($objCreditPages = FileCreditPageModel::findPublishedByPids(array($objModel->id))) === null) {
return null;
}
while ($objCreditPages->next()) {
$arrCredit = $objCreditPages->row();
// not a child of current root page
if (!empty($arrPids) && !in_array($arrCredit['page'], $arrPids)) {
continue;
}
if ($arrCredit['url'] == '' && ($objTarget = \PageModel::findByPk($arrCredit['page'])) !== null) {
$arrCredit['url'] = \Controller::generateFrontendUrl($objTarget->row());
}
$arrPages[] = $arrCredit;
}
if ($arrPages === null) {
return null;
}
$objTemplate->setData($objModel->row());
$objTemplate->fileData = $objFilesModel->row();
static::addCopyrightToTemplate($objTemplate, $objFilesModel, $objModule);
$objTemplate->link = $GLOBALS['TL_LANG']['MSC']['creditLinkText'];
$objTemplate->pagesLabel = $GLOBALS['TL_LANG']['MSC']['creditPagesLabel'];
$objTemplate->path = $objFilesModel->path;
$objTemplate->pages = $arrPages;
$objTemplate->pageCount = count($arrPages);
// colorbox support
if ($objPage->outputFormat == 'xhtml') {
$strLightboxId = 'lightbox';
} else {
$strLightboxId = 'lightbox[' . substr(md5($objTemplate->getName() . '_' . $objFilesModel->id), 0, 6) . ']';
}
$objTemplate->attribute = $strLightboxId ? ($objPage->outputFormat == 'html5' ? ' data-gallery="#gallery-' . $objModule->id . '" data-lightbox="' : ' rel="') . $strLightboxId . '"' : '';
$objTemplate->addImage = false;
// Add an image
if (!is_file(TL_ROOT . '/' . $objModel->path)) {
$arrData = array('singleSRC' => $objFilesModel->path, 'doNotIndex' => true);
$size = deserialize($objModule->imgSize);
if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
$arrData['size'] = $objModule->imgSize;
}
\Controller::addImageToTemplate($objTemplate, $arrData);
}
return array('pages' => $arrPages, 'order' => static::getSortValue($objModule->creditsSortBy, $objTemplate), 'group' => static::getGroupValue($objModule->creditsGroupBy, $objTemplate), 'output' => $objTemplate->parse());
}
示例7: parseEmployee
/**
* Parse an item and return it as string
* @param object
* @param boolean
* @param string
* @param integer
* @return string
*/
protected function parseEmployee($objEmployee, $blnAddStaff = false, $strClass = '', $intCount = 0)
{
global $objPage;
$objTemplate = new \FrontendTemplate($this->staff_employee_template);
$objTemplate->setData($objEmployee->row());
$objTemplate->class = ($this->staff_employee_class != '' ? ' ' . $this->staff_employee_class : '') . $strClass;
if (!empty($objEmployee->education)) {
$objTemplate->education = deserialize($objEmployee->education);
}
$objTemplate->link = $this->generateEmployeeUrl($objEmployee, $blnAddStaff);
$objTemplate->staff = $objEmployee->getRelated('pid');
$objTemplate->txt_educations = $GLOBALS['TL_LANG']['MSC']['educations'];
$objTemplate->txt_contact = $GLOBALS['TL_LANG']['MSC']['contact'];
$objTemplate->txt_room = $GLOBALS['TL_LANG']['MSC']['room'];
$objTemplate->txt_phone = $GLOBALS['TL_LANG']['MSC']['phone'];
$objTemplate->txt_mobile = $GLOBALS['TL_LANG']['MSC']['mobile'];
$objTemplate->txt_fax = $GLOBALS['TL_LANG']['MSC']['fax'];
$objTemplate->txt_email = $GLOBALS['TL_LANG']['MSC']['email'];
$objTemplate->txt_website = $GLOBALS['TL_LANG']['MSC']['website'];
$objTemplate->txt_facebook = $GLOBALS['TL_LANG']['MSC']['facebook'];
$objTemplate->txt_googleplus = $GLOBALS['TL_LANG']['MSC']['googleplus'];
$objTemplate->txt_twitter = $GLOBALS['TL_LANG']['MSC']['twitter'];
$objTemplate->txt_linkedin = $GLOBALS['TL_LANG']['MSC']['linkedin'];
$objTemplate->count = $intCount;
// see #5708
$objTemplate->addImage = false;
// Add an image
if ($objEmployee->singleSRC != '') {
$objModel = \FilesModel::findByUuid($objEmployee->singleSRC);
if ($objModel === null) {
if (!\Validator::isUuid($objEmployee->singleSRC)) {
$objTemplate->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
} elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
// Do not override the field now that we have a model registry (see #6303)
$arrEmployee = $objEmployee->row();
// Override the default image size
if ($this->imgSize != '') {
$size = deserialize($this->imgSize);
if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
$arrEmployee['size'] = $this->imgSize;
}
}
$arrEmployee['singleSRC'] = $objModel->path;
$strLightboxId = 'lightbox[lb' . $this->id . ']';
$arrEmployee['fullsize'] = $this->fullsize;
$this->addImageToTemplate($objTemplate, $arrEmployee, null, $strLightboxId);
}
}
$objTemplate->enclosure = array();
// Add enclosures
if ($objEmployee->addEnclosure) {
$this->addEnclosuresToTemplate($objTemplate, $objEmployee->row());
}
return $objTemplate->parse();
}
示例8: compile
protected function compile()
{
$arrContent = array();
$objContent = $this->Database->prepare("SELECT * FROM tl_content WHERE tstamp > ? && outSide_log = ? && invisible = ? ORDER BY tstamp DESC")->execute($this->Member->lastLogin, '', '');
while ($objContent->next()) {
$arrItem = $objContent->row();
if ($objContent->type == 'module') {
$objModule = \ModuleModel::findById($objContent->module);
}
if ($objContent->type != 'module' or $objContent->type == 'module' && $objModule->type != 'content_log') {
$arrItem['htmlElement'] = $this->getContentElement($objContent->id);
foreach ($GLOBALS['TL_HOOKS']['contentLog'] as $callback) {
$this->import($callback[0]);
$arrItem = $this->{$callback}[0]->{$callback}[1]($objContent->ptable, $objContent->tstamp, $arrItem);
}
if ($mod++ % 2 == 0) {
$arrItem['css'] .= 'even';
} else {
$arrItem['css'] .= 'odd';
}
$arrItem['headline'] = deserialize($arrItem['headline']);
$arrItem['parseDate'] = '<time datetime="' . date('Y-m-d\\TH:i:sP', $arrItem['tstamp']) . '">' . \Date::parse($GLOBALS['objPage']->datimFormat, $arrItem['tstamp']) . '</time>';
$arrContent[] = (object) $arrItem;
}
}
$objFAQ = $this->Database->prepare("SELECT * FROM tl_faq WHERE tstamp > ? && published = ? ORDER BY tstamp DESC")->execute($this->Member->lastLogin, '1');
while ($objFAQ->next()) {
$arrItem = $objFAQ->row();
foreach ($GLOBALS['TL_HOOKS']['contentLog'] as $callback) {
$this->import($callback[0]);
$arrItem = $this->{$callback}[0]->{$callback}[1]('tl_faq', $objFAQ->tstamp, $arrItem);
}
if ($mod++ % 2 == 0) {
$arrItem['css'] .= 'even';
} else {
$arrItem['css'] .= 'odd';
}
$arrItem['parseDate'] = '<time datetime="' . date('Y-m-d\\TH:i:sP', $arrItem['tstamp']) . '">' . \Date::parse($GLOBALS['objPage']->datimFormat, $arrItem['tstamp']) . '</time>';
$arrContent[] = (object) $arrItem;
}
$arrContent[0]->css .= ' first';
$arrContent[count($arrContent) - 1]->css .= ' last';
foreach ($arrContent as $v) {
$objTemplate = new \FrontendTemplate($this->contentLogTpl);
$objTemplate->setData((array) $v);
$html .= $objTemplate->parse();
}
if ($this->contentLogTpl == 'cl_list') {
$html = '<table>' . $html . '</table>';
}
$this->Template->html = $html;
}
示例9: parseMember
protected function parseMember($objMember)
{
global $objPage;
$objT = new \FrontendTemplate('memberlist_default');
$objT->setData($objMember->row());
$strUrl = $this->generateMemberUrl($objMember);
$objT->addImage = false;
// Add an image
if ($objMember->addImage && $objMember->singleSRC != '') {
$objModel = \FilesModel::findByUuid($objMember->singleSRC);
if ($objModel === null) {
if (!\Validator::isUuid($objMember->singleSRC)) {
$objMember->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
} elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
// Do not override the field now that we have a model registry (see #6303)
$arrMember = $objMember->row();
// Override the default image size
if ($this->size != '') {
$size = deserialize($this->size);
if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
$arrMember['size'] = $this->size;
}
}
$arrMember['singleSRC'] = $objModel->path;
\Controller::addImageToTemplate($objT, $arrMember);
}
}
$arrTitle = array($objMember->academicTitle, $objMember->firstname, $objMember->lastname);
$objT->titleCombined = empty($arrTitle) ? '' : implode(' ', $arrTitle);
$arrLocation = array($objMember->postal, $objMember->city);
$objT->locationCombined = empty($arrLocation) ? '' : implode(' ', $arrLocation);
$objT->websiteLink = $objMember->website;
$objT->websiteTitle = $GLOBALS['TL_LANG']['MSC']['memberlist']['websiteTitle'];
// Add http:// to the website
if ($objMember->website != '' && !preg_match('@^(https?://|ftp://|mailto:|#)@i', $objMember->website)) {
$objT->websiteLink = 'http://' . $objMember->website;
}
if ($this->mlSource == 'external') {
// Encode e-mail addresses
if (substr($this->mlUrl, 0, 7) == 'mailto:') {
$strUrl = \String::encodeEmail($this->mlUrl);
} else {
$strUrl = ampersand($this->mlUrl);
}
}
$objT->link = $strUrl;
$objT->linkTarget = $this->mlTarget ? $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"' : '';
$objT->linkTitle = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['openMember'], $objT->titleCombined));
return $objT->parse();
}
示例10: generate
public function generate()
{
$objT = new \FrontendTemplate('fieldpalette_button_default');
$objT->setData($this->arrOptions);
$objT->href = $this->generateHref();
$strAttribues = '';
if (is_array($this->arrOptions['attributes'])) {
foreach ($this->arrOptions['attributes'] as $key => $arrValues) {
$strAttribues .= implode(' ', $this->arrOptions['attributes']);
}
}
$objT->attributes = strlen($strAttribues) > 0 ? ' ' . $strAttribues : '';
return $objT->parse();
}
示例11: generateMarkup
/**
* Generate the markup for the default uploader
*
* @return string
*/
public function generateMarkup()
{
$arrValues = array_values($this->value ?: array());
$objT = new \FrontendTemplate($this->strTemplate);
$objT->setData($this->arrData);
$objT->id = $this->strField;
$objT->uploadMultiple = $this->uploadMultiple;
$objT->initialFiles = json_encode($arrValues);
$objT->initialFilesFormatted = $this->prepareValue();
$objT->uploadedFiles = '[]';
$objT->deletedFiles = '[]';
$objT->attributes = $this->getAttributes($this->getDropZoneOptions());
return $objT->parse();
}
示例12: parseCarpet
/**
* Parse an item and return it as string
* @param object
* @param boolean
* @param string
* @param integer
* @return string
*/
protected function parseCarpet($objCarpet, $blnAddCategory = false, $strClass = '', $intCount = 0)
{
global $objPage;
$objTemplate = new \FrontendTemplate($this->carpet_template);
$objTemplate->setData($objCarpet->row());
$objTemplate->class = ($this->carpet_Class != '' ? ' ' . $this->carpet_Class : '') . $strClass;
$objTemplate->rate = $objCarpet->visit / 10;
$objTemplate->rateid = $this->generateRandomString();
$objTemplate->totalknots = $objCarpet->kwidth * $objCarpet->kheight;
if ($objCarpet->knots > 0) {
$objTemplate->widthcm = round($objCarpet->kwidth * 7 / $objCarpet->knots);
$objTemplate->heightcm = round($objCarpet->kheight * 7 / $objCarpet->knots);
} else {
$objTemplate->widthcm = '-';
$objTemplate->heightcm = '-';
}
if ($this->carpet_price) {
$objTemplate->price = number_format($objCarpet->price);
$objTemplate->show_price = $this->carpet_price;
}
$objTemplate->link = $this->generateCarpetUrl($objCarpet, $blnAddCategory);
$objTemplate->category = $objCarpet->getRelated('pid');
$objTemplate->count = $intCount;
// see #5708
// Add an image
if ($objCarpet->singleSRC != '') {
$objModel = \FilesModel::findByUuid($objCarpet->singleSRC);
if ($objModel === null) {
if (!\Validator::isUuid($objCarpet->singleSRC)) {
$objTemplate->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
} elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
// Do not override the field now that we have a model registry (see #6303)
$arrCarpet = $objCarpet->row();
// Override the default image size
if ($this->imgSize != '') {
$size = deserialize($this->imgSize);
if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
$arrCarpet['size'] = $this->imgSize;
}
}
$arrCarpet['singleSRC'] = $objModel->path;
$strLightboxId = 'lightbox[lb' . $this->id . ']';
$arrCarpet['fullsize'] = $this->fullsize;
$this->addImageToTemplate($objTemplate, $arrCarpet, null, $strLightboxId);
}
}
return $objTemplate->parse();
}
示例13: getParsedActivities
public static function getParsedActivities($intCompany, \Module $objModule = null)
{
$strResult = '';
\Controller::loadDataContainer('tl_company_activity');
\System::loadLanguageFile('tl_company_activity');
if (($objActivities = static::getActivities($intCompany)) !== null) {
while ($objActivities->next()) {
$objTemplate = new \FrontendTemplate('company_activity_default');
$objTemplate->setData($objActivities->row());
$objTemplate->module = $objModule;
$strResult .= $objTemplate->parse();
}
}
return $strResult;
}
示例14: parseRecipe
/**
* Parse an item and return it as string
* @param object
* @param string
* @param integer
* @return string
*/
protected function parseRecipe($objRecipe, $strClass = '', $intCount = 0)
{
global $objPage;
$objTemplate = new \FrontendTemplate($this->item_template);
$objTemplate->setData($objRecipe->row());
$objTemplate->class = ($objRecipe->cssClass != '' ? ' ' . $objRecipe->cssClass : '') . $strClass;
// $objTemplate->distance = $this->getCurrentOpenStatus($objRecipe);
//Detail-Url
if ($this->jumpTo) {
$objDetailPage = \PageModel::findByPk($this->jumpTo);
$objTemplate->detailUrl = ampersand($this->generateFrontendUrl($objDetailPage->row(), '/' . $objRecipe->alias));
$objTemplate->teaser = \String::substr($objRecipe->preparation, 100);
}
return $objTemplate->parse();
}
示例15: parseLink
/**
* Generate the module
*/
protected function parseLink($objLink, $strClass = '', $intCount = 0)
{
$objTemplate = new \FrontendTemplate($this->links_template);
$objTemplate->setData($objLink->row());
$strImage = '';
$objImage = \FilesModel::findByPk($objLink->singleSRC);
$size = deserialize($this->imgSize);
// Add image
if ($objImage !== null) {
$strImage = \Image::getHtml(\Image::get($objImage->path, $size[0], $size[1], $size[2]));
}
$objTemplate->class = $strClass;
$objTemplate->linkTitle = $objLink->linkTitle ? $objLink->linkTitle : $objLink->title;
$objTemplate->image = $strImage;
return $objTemplate->parse();
}