public function action_save() { $block = new stdClass(); $block->data = $this->request->post(); $block->page_id = $this->request->query('page_id'); $block->page_block_template_id = $this->request->query('page_block_template_id'); View::set_global('preview', TRUE); $page = Model_Page::factory('Page', $block->page_id); View::bind_global('page', $page); $result = Model_Page::instance()->render_block($block); $this->response->body($result); }
<?php if ($preview) { $options_type = array('success' => 'Success', 'info' => 'Info', 'warning' => 'Warning', 'danger' => 'Danger'); echo $helper->option($_data, 'type', $options_type, 'success'); } ?> <div class="alert alert-<?php echo Arr::get($_data, 'type', 'success'); ?> " role="alert"> <?php echo Model_Page::instance()->blocks(Arr::get($_data, 'content'), 'content'); ?> </div>
<div class="thumbnail"> <img src="<?php echo Arr::get($_data, 'image', 'http://lorempixel.com/g/1000/600/'); ?> " property="image" property-type="image"> <?php if ($preview or Arr::get($_data, 'caption')) { ?> <div class="caption"> <?php echo Model_Page::instance()->blocks(Arr::get($_data, 'caption'), 'caption'); ?> </div> <?php } ?> </div>
<?php if ($preview) { $options_type = array('' => 'Default', 'form-inline' => 'Inline', 'form-horizontal' => 'Horizontal'); echo $helper->option($_data, 'type', $options_type, ''); } ?> <form class="<?php echo Arr::get($_data, 'type'); ?> "> <?php echo Model_Page::instance()->blocks(Arr::get($_data, 'form'), 'form'); ?> </form>
<?php if ($preview) { echo $helper->hidden($_data, 'config', '2 2 2 2 2 2'); } $config = Arr::get($_data, 'config', '2 2 2 2 2 2'); $items = explode(' ', trim($config)); ?> <div class="row"> <?php foreach ($items as $index => $item) { ?> <div class="col-sm-12 col-md-<?php echo $item; ?> "> <?php echo Model_Page::instance()->blocks(Arr::get($_data, 'col-' . $index), 'col-' . $index); ?> </div> <?php } ?> </div>