/**
  * 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);
 }
 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);
 }
 /**
  * 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));
 }
 /**
  *
  * @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;
 }
 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;
     }
 }
 public function index()
 {
     echo SSViewer::execute_template('DevToolsIndex', null);
 }
 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;
 }
Exemple #8
0
 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")));
 }
 public function securityAction()
 {
     $this->header();
     $data = new ViewableData();
     echo SSViewer::execute_template('DevInfoSecurity', $data);
 }