本文整理汇总了PHP中SSViewer::execute_template方法的典型用法代码示例。如果您正苦于以下问题:PHP SSViewer::execute_template方法的具体用法?PHP SSViewer::execute_template怎么用?PHP SSViewer::execute_template使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSViewer
的用法示例。
在下文中一共展示了SSViewer::execute_template方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
/**
* Format the exported data as YAML.
*
* @param \ArrayData $templateData
* @return void
*/
public function format($templateData)
{
$viewer = SSViewer::execute_template('WorkflowDefinitionExport', $templateData);
// Temporary until we find the source of the replacement in SSViewer
$processed = str_replace('&', '&', $viewer);
// Clean-up newline "gaps" that SSViewer leaves behind from the placement of template control structures
return preg_replace("#^\\R+|^[\t\\s]*\\R+#m", '', $processed);
}
示例2: one
public function one(SS_HTTPRequest $request)
{
$this->header();
$hash = $request->param('hash');
$data = new ViewableData();
$data->Error = Error::get()->filter('Hash', $hash)->limit(1)->first();
$data->ErrorOccurances = ErrorOccurance::get()->filter('Hash', $hash)->sort('Created DESC');
echo SSViewer::execute_template('ErrorDetail', $data);
}
示例3: Field
/**
* Render the cart with editable item fields.
*
* @param array $properties
*/
public function Field($properties = array())
{
$editables = $this->editableItems();
$customcartdata = array('Items' => $editables);
// NOTE: this was originally incorrect - passing just $editables and $customcartdata
// which broke modules like Display_Logic.
$this->extend('onBeforeRender', $this, $editables, $customcartdata);
return SSViewer::execute_template($this->template, $this->cart->customise($customcartdata), array('Editable' => true));
}
示例4: getColumnContent
/**
*
* @param \GridField $gridField
* @param \DataObject $record
* @param string $columnName
* @return string|null - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record instanceof \Payment) {
return null;
}
\Requirements::css('omnipay-ui/css/omnipay-ui-cms.css');
\Requirements::javascript('omnipay-ui/javascript/omnipay-ui-cms.js');
if (preg_match('/Pending(Capture|Void|Refund)/', $record->Status)) {
return \SSViewer::execute_template('PaymentPendingIndicator', \ArrayData::create(array('StatusLink' => \Controller::join_links($gridField->Link('checkPaymentPending')), 'PaymentID' => $record->ID, 'Timeout' => 2000)));
}
return null;
}
示例5: process
public function process()
{
$fromTime = $this->since ? $this->since : 0;
$members = $this->members;
$nextId = array_shift($members);
$this->members = $members;
$member = Member::get()->byID($nextId);
$microBlogService = $this->microBlogService;
// if we don't have a 'since' time, we need to only scan from 'now' onwards, to prevent _every_
// post from being collected
if (!$fromTime) {
$fromTime = time();
}
$since = date('Y-m-d 00:00:00', $fromTime);
if ($member && $member->ID) {
$this->transactionManager->run(function () use($microBlogService, $since, $member) {
$posts = $microBlogService->globalFeed(array('ParentID' => 0, 'ThreadOwnerID:not' => $member->ID, 'Created:GreaterThan' => $since), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = false);
if (!count($posts)) {
return;
}
$content = SSViewer::execute_template('DigestEmail', ArrayData::create(array('Posts' => $posts, 'Member' => $member)));
$content = HTTP::absoluteURLs($content);
$config = SiteConfig::current_site_config();
$mail = new Email();
$mail->setTo($member->Email);
$mail->setBody($content);
$mail->setSubject($config->Title . ' digest');
if ($config->FromEmail) {
$mail->setFrom($config->FromEmail);
}
$mail->send();
}, $member);
}
$this->currentStep++;
if (count($members) == 0) {
if (!$this->sendTime) {
$this->sendTime = '23:55:00';
}
$nextTime = $this->type == 'weekly' ? '+1 week' : '+1 day';
$nextDate = date('Y-m-d ' . $this->sendTime, strtotime($nextTime));
$nextJob = new MicroPostDigestJob(time(), $this->type, $this->groupId, $this->sendTime);
singleton('QueuedJobService')->queueJob($nextJob, $nextDate);
$this->isComplete = true;
}
}
示例6: index
public function index()
{
echo SSViewer::execute_template('DevToolsIndex', null);
}
示例7: digest
public function digest()
{
if (!Permission::check('ADMIN')) {
return $this->httpError(403);
}
$posts = $this->microBlogService->globalFeed(array('Created:GreaterThan' => date('Y-m-d 00:00:00', strtotime('-1 month'))), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = false);
if (!count($posts)) {
return;
}
$content = SSViewer::execute_template('DigestEmail', ArrayData::create(array('Posts' => $posts, 'Member' => Member::currentUser())));
$content = HTTP::absoluteURLs($content);
echo $content;
}
示例8: __construct
public function __construct($controller, $name = "CartForm", $cart = null, $template = "Cart")
{
$this->cart = $cart;
parent::__construct($controller, $name, new FieldList(LiteralField::create("cartcontent", SSViewer::execute_template($template, $cart->customise(array('Items' => $this->editableItems($cart->Items()))), array('Editable' => true)))), new FieldList(FormAction::create("updatecart", "Update Cart")));
}
示例9: securityAction
public function securityAction()
{
$this->header();
$data = new ViewableData();
echo SSViewer::execute_template('DevInfoSecurity', $data);
}