<?php $block_type = $_POST['add-block']; $block_index = (int) $_POST['count']; $field_id = $item_id; echo PerchContent_Util::get_empty_block($field_id, $block_type, $block_index, $Page, $Template, $Form);
public function handle_empty_block_generation($Template) { if (PerchUtil::post('add-block')) { echo PerchContent_Util::get_empty_block(null, PerchUtil::post('add-block'), (int) PerchUtil::post('count'), false, $Template, $this); exit; } }
$draft = true; if ($Region->regionPage() == '*') { $Alert->set('draft', PerchLang::get('You are editing a draft.')); } else { $path = rtrim($Settings->get('siteURL')->val(), '/'); if ($Region->get_option('edit_mode') == 'listdetail' && $Region->get_option('searchURL') != '') { $search_url = $Region->get_option('searchURL'); $Region->tmp_url_vars = $details[0]; $search_url = preg_replace_callback('/{([A-Za-z0-9_\\-]+)}/', array($Region, 'substitute_url_vars'), $search_url); $Region->tmp_url_vars = false; if (strpos($search_url, '?') !== false) { $preview_url = $search_url . '&' . PERCH_PREVIEW_ARG . '=all'; } else { $preview_url = $search_url . '?' . PERCH_PREVIEW_ARG . '=all'; } } else { $preview_url = $path . $Region->regionPage() . '?' . PERCH_PREVIEW_ARG . '=all'; } $Alert->set('draft', PerchLang::get('You are editing a draft.') . ' <a href="' . PerchUtil::html($preview_url) . '" class="action draft-preview">' . PerchLang::get('Preview') . '</a>'); } } else { $draft = false; } if (isset($_GET['created'])) { $Alert->set('success', PerchLang::get('Content successfully updated and a new item added.')); } //$Perch->add_javascript(PERCH_LOGINPATH.'/core/assets/js/repeaters.js?v='.$Perch->version); //$Perch->add_css(PERCH_LOGINPATH.'/core/assets/css/repeaters.css?v='.$Perch->version); if (PerchUtil::count($details)) { $details = PerchContent_Util::flatten_details($details); }
public static function display_block($id, $blocks_index, $block_data, $count, $Page, $Template, $Form, &$stamp, $empty = false) { if ($id === null) { $block_id = '_blocks_' . $count; } else { $block_id = $id . '__blocks_' . $count; } $label = false; if (isset($blocks_index[$block_data['_block_type']])) { $Tag = $blocks_index[$block_data['_block_type']]; $label = $Tag->label(); } if (!$label) { $label = $block_data['_block_type']; } if (!isset($block_data['_block_id'])) { $block_data['_block_id'] = base_convert($stamp, 10, 36); $stamp++; } $block_tags = $Template->get_block_tags($block_data['_block_type']); $block_tags[] = new PerchXMLTag('<perch:' . $Template->namespace . ' id="_block_type" value="' . $block_data['_block_type'] . '" type="editcontrol" edit-control="true" />'); $block_tags[] = new PerchXMLTag('<perch:' . $Template->namespace . ' id="_block_id" value="' . $block_data['_block_id'] . '" type="editcontrol" edit-control="true" />'); $block_tags[] = new PerchXMLTag('<perch:' . $Template->namespace . ' id="_block_index" class="index" value="' . $count . '" type="editcontrol" edit-control="true" />'); echo '<div class="block-wrap" tabindex="0" data-block="' . $block_data['_block_id'] . '" data-prefix="' . $block_id . '"' . ($empty ? ' data-empty="true"' : '') . '>'; echo '<div class="block-item">'; echo '<h2 class="divider">' . PerchUtil::html($label) . '<span class="rm"></span></h2>'; PerchContent_Util::display_item_fields($block_tags, $block_id, $block_data, $Page, $Form, $Template); echo '</div>'; echo '</div>'; }
if (isset($item['perch_' . $id . '__title'])) { echo '<h2>' . PerchUtil::html($item['perch_' . $id . '__title']) . '</h2>'; } else { if (isset($item['itemOrder'])) { echo '<h2>' . PerchLang::get('Item') . ' ' . PerchUtil::html($item['itemOrder'] - 999) . '</h2>'; } else { //PerchUtil::debug($item); echo '<h2>' . PerchLang::get('New Item') . '</h2>'; } } echo '<a href="' . PERCH_LOGINPATH . '/core/apps/content/delete/item/?id=' . PerchUtil::html($Region->id()) . '&itm=' . $id . '" class="delete action inline-delete">' . PerchLang::get('Delete') . '</a>'; echo '</div>'; } else { echo '<h2 class="em">' . PerchUtil::html($Region->regionKey()) . '</h2>'; } PerchContent_Util::display_item_fields($tags, $id, $item, $Page, $Form, $Template); echo '</div>'; $i++; // item count } } ?> </div> <p class="submit<?php if (defined('PERCH_NONSTICK_BUTTONS') && PERCH_NONSTICK_BUTTONS) { echo ' nonstick'; } if ($Form->error) { echo ' error'; }