| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
die('Access denied.'); |
| 4 |
} |
| 5 |
?> |
| 6 |
<div class='wrap js'> |
| 7 |
<?php if (!$this->get->get('action')) { ?> |
| 8 |
<h1><?php _e('Templates', 'e2pdf'); ?> |
| 9 |
<a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action"> |
| 10 |
<?php _e('Add new', 'e2pdf') ?> |
| 11 |
</a> |
| 12 |
</h1> |
| 13 |
<hr class="wp-header-end"> |
| 14 |
<?php $this->render('blocks', 'notifications'); ?> |
| 15 |
<?php $this->render('blocks', 'sub-filters'); ?> |
| 16 |
<form id="e2pdf-templates-filter" method="post"> |
| 17 |
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>"> |
| 18 |
<p class="search-box"> |
| 19 |
<label class="screen-reader-text" for="post-search-input"><?php _e('Search Templates', 'e2pdf'); ?></label> |
| 20 |
<input type="search" id="post-search-input" name="s" value="<?php echo $this->get->get('s'); ?>"> |
| 21 |
<input type="submit" id="search-submit" class="button" value="<?php _e('Search Templates', 'e2pdf'); ?>"> |
| 22 |
</p> |
| 23 |
<div class="tablenav top e2pdf-templates-list-tablenav"> |
| 24 |
<?php |
| 25 |
if ($this->get->get('status') == 'trash') { |
| 26 |
$this->render('blocks', 'bulk-actions', array( |
| 27 |
'id' => 'doaction', |
| 28 |
'name' => 'action', |
| 29 |
'options' => array( |
| 30 |
'restore' => __('Restore', 'e2pdf'), |
| 31 |
'delete' => __('Delete', 'e2pdf') |
| 32 |
) |
| 33 |
)); |
| 34 |
} else { |
| 35 |
$this->render('blocks', 'bulk-actions', array( |
| 36 |
'id' => 'doaction', |
| 37 |
'name' => 'action', |
| 38 |
'options' => array( |
| 39 |
'trash' => __('Move To Trash', 'e2pdf') |
| 40 |
) |
| 41 |
)); |
| 42 |
} |
| 43 |
?> |
| 44 |
<div class="alignright actions bulkactions"><a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'import'))); ?>" class="button action"> |
| 45 |
<?php _e('Import', 'e2pdf') ?> |
| 46 |
</a></div> |
| 47 |
</div> |
| 48 |
<table class="wp-list-table widefat fixed striped pages e2pdf-templates-list"> |
| 49 |
<thead> |
| 50 |
<tr> |
| 51 |
<td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php _e('Select All', 'e2pdf'); ?></label><input id="cb-select-all-1" type="checkbox"></td> |
| 52 |
<th scope="col" id="id" class="manage-column column-id sortable <?php if ($this->get->get('orderby') == 'id') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>"> |
| 53 |
<a href="<?php |
| 54 |
if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') { |
| 55 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc')); |
| 56 |
} else { |
| 57 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc')); |
| 58 |
} |
| 59 |
?>"> |
| 60 |
<span><?php _e('ID', 'e2pdf'); ?></span> |
| 61 |
<span class="sorting-indicator"></span> |
| 62 |
</a> |
| 63 |
</th> |
| 64 |
<th scope="col" id="title" class="manage-column column-title column-primary sortable <?php if ($this->get->get('orderby') == 'title') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>"> |
| 65 |
<a href="<?php |
| 66 |
if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { |
| 67 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc')); |
| 68 |
} else { |
| 69 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc')); |
| 70 |
} |
| 71 |
?>"> |
| 72 |
<span><?php _e('Title', 'e2pdf'); ?></span> |
| 73 |
<span class="sorting-indicator"></span> |
| 74 |
</a> |
| 75 |
</th> |
| 76 |
<th scope="col" id="item" class="manage-column column-item"><?php _e('Item', 'e2pdf'); ?></th> |
| 77 |
<th scope="col" id="shortcodes" class="manage-column column-shortcode"><?php _e('Shortcode', 'e2pdf'); ?></th> |
| 78 |
<th scope="col" id="updated" class="manage-column column-updated sortable <?php if ($this->get->get('orderby') == 'updated_at') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>"> |
| 79 |
<a href="<?php |
| 80 |
if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') { |
| 81 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc')); |
| 82 |
} else { |
| 83 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc')); |
| 84 |
} |
| 85 |
?>"> |
| 86 |
<span><?php _e('Updated', 'e2pdf'); ?></span> |
| 87 |
<span class="sorting-indicator"> |
| 88 |
</span> |
| 89 |
</a> |
| 90 |
</th> |
| 91 |
<th scope="col" id="activation" class="manage-column column-activation"><?php _e('Activation', 'e2pdf'); ?></th> |
| 92 |
</tr> |
| 93 |
</thead> |
| 94 |
<tbody id="the-list"> |
| 95 |
<?php if ($this->is_empty($this->controller->get_templates_list($this->get->get()))) { ?> |
| 96 |
<tr class="no-items"> |
| 97 |
<td class="colspanchange" colspan="7"> |
| 98 |
<?php _e('No Templates Found', 'e2pdf'); ?> <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>"><?php _e('Add new', 'e2pdf') ?></a> |
| 99 |
</td> |
| 100 |
</tr> |
| 101 |
<?php } else { ?> |
| 102 |
<?php foreach ($this->controller->get_templates_list($this->get->get()) as $key => $template) { ?> |
| 103 |
<tr id="post-<?php echo $template->get('ID'); ?>" class="iedit author-self level-0 post-<?php echo $template->get('ID'); ?> type-page status-publish hentry"> |
| 104 |
<th scope="row" class="check-column"> |
| 105 |
<label class="screen-reader-text" for="cb-select-2">Select Sample Page</label> |
| 106 |
<input id="cb-select-2" type="checkbox" name="post[]" value="<?php echo $template->get('ID'); ?>"> |
| 107 |
</th> |
| 108 |
<td class="id column-id" data-colname="ID"><?php echo $template->get('ID'); ?></td> |
| 109 |
<td class="title column-title has-row-actions column-primary page-title" data-colname="Title"><div class="locked-info"><span class="locked-avatar"></span><span class="locked-text"></span></div> |
| 110 |
<strong><a class="row-title" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $template->get('ID'))); ?>"><?php echo $template->get('title'); ?></a></strong> |
| 111 |
<div class="row-actions"> |
| 112 |
<?php if ($this->get->get('status') == 'trash') { ?> |
| 113 |
<span class="restore"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'restore', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>" rel="permalink"><?php _e('Restore', 'e2pdf'); ?></a> | </span> |
| 114 |
<span class="delete"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'delete', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>" onclick="return confirm('<?php _e('Delete permanently?', 'e2pdf'); ?> ')" class="submitdelete"><?php _e('DELETE', 'e2pdf'); ?></a></span> |
| 115 |
<?php } else { ?> |
| 116 |
<span class="edit"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $template->get('ID'))); ?>"><?php _e('Edit', 'e2pdf'); ?></a> | </span> |
| 117 |
<span class="duplicate"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'duplicate', 'id' => $template->get('ID'))); ?>"><?php _e('Duplicate', 'e2pdf'); ?></a> | </span> |
| 118 |
<span class="trash"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'trash', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>" class="submitdelete"><?php _e('Delete', 'e2pdf'); ?></a> | </span> |
| 119 |
<span class="view"><a target="_blank" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'view', 'id' => $template->get('ID'))); ?>" rel="permalink"><?php _e('View', 'e2pdf'); ?></a> | </span> |
| 120 |
<span class="backup"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'backup', 'id' => $template->get('ID'))); ?>" rel="permalink"><?php _e('Backup', 'e2pdf'); ?></a></span> |
| 121 |
<?php } ?> |
| 122 |
</div> |
| 123 |
<button type="button" class="toggle-row"><span class="screen-reader-text"><?php _e('Show more details', 'e2pdf'); ?></span></button> |
| 124 |
</td> |
| 125 |
<td class="item column-item" data-colname="Item"> |
| 126 |
<div><?php if ($template->extension()->method('item') && $template->get('item')) { ?><a target="_blank" href="<?php echo $template->extension()->item()->url; ?>"><?php echo $template->extension()->item()->name; ?></a><?php } else { ?>—<?php } ?></div> |
| 127 |
<div class="e2pdf-small"><?php if ($template->extension()->method('info')) { ?> <?php echo $template->extension()->info('title'); ?> <?php } ?></div> |
| 128 |
</td> |
| 129 |
<td class="shortcode column-shortcode" data-colname="Shortcode"> |
| 130 |
<div class="e2pdf-rel e2pdf-closed"> |
| 131 |
<a href="javascript:void(0);" class="e2pdf-link e2pdf-hidden-dropdown button e2pdf-w100 e2pdf-center"><?php _e('Shortcodes', 'e2pdf') ?> <span class="toggle-indicator" aria-hidden="true"></span></a> |
| 132 |
<div class="e2pdf-hidden-dropdown-content"> |
| 133 |
<div class="misc-pub-section misc-pub-e2pdf-shortcode"> |
| 134 |
<input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-attachment id="<?php echo $template->get('ID'); ?>"]'> |
| 135 |
</div> |
| 136 |
<div class="misc-pub-section misc-pub-e2pdf-shortcode"> |
| 137 |
<input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-download id="<?php echo $template->get('ID'); ?>"]'> |
| 138 |
</div> |
| 139 |
<div class="misc-pub-section misc-pub-e2pdf-shortcode"> |
| 140 |
<input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-save id="<?php echo $template->get('ID'); ?>"]'> |
| 141 |
</div> |
| 142 |
<div class="misc-pub-section misc-pub-e2pdf-shortcode"> |
| 143 |
<input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-view id="<?php echo $template->get('ID'); ?>"]'> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
</div> |
| 147 |
</td> |
| 148 |
<td class="updated column-updated" data-colname="<?php _e('Updated', 'e2pdf') ?>"> |
| 149 |
<abbr title="<?php echo $template->get('updated_at'); ?>"><?php echo $template->get('updated_at'); ?></abbr> |
| 150 |
<div class="e2pdf-small">by <strong><?php echo get_userdata($template->get('author'))->user_nicename; ?></strong></div> |
| 151 |
</td> |
| 152 |
<td class="author column-activation" data-colname="Activation"> |
| 153 |
<span id="e2pdf-list-post-activation"> |
| 154 |
<?php if ($template->get('activated')) { ?> |
| 155 |
<a class="e2pdf-color-green e2pdf-deactivate-template e2pdf-link" data-id="<?php echo $template->get('ID'); ?>" href="javascript:void(0);"><?php _e('Activated', 'e2pdf'); ?></a> |
| 156 |
<?php } else { ?> |
| 157 |
<a class="e2pdf-color-red e2pdf-activate-template e2pdf-link" data-id="<?php echo $template->get('ID'); ?>" href="javascript:void(0);"><?php _e('Not Activated', 'e2pdf'); ?></a> |
| 158 |
<?php } ?></span> |
| 159 |
</td> |
| 160 |
</tr> |
| 161 |
<?php } ?> |
| 162 |
<?php } ?> |
| 163 |
</tbody> |
| 164 |
<tfoot> |
| 165 |
<tr> |
| 166 |
<td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo _e('Select All', 'e2pdf'); ?></label><input id="cb-select-all-1" type="checkbox"></td> |
| 167 |
<th scope="col" id="id" class="manage-column column-id sortable <?php if ($this->get->get('orderby') == 'id') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>"> |
| 168 |
<a href="<?php |
| 169 |
if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') { |
| 170 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc')); |
| 171 |
} else { |
| 172 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc')); |
| 173 |
} |
| 174 |
?>"> |
| 175 |
<span><?php _e('ID', 'e2pdf'); ?></span> |
| 176 |
<span class="sorting-indicator"></span> |
| 177 |
</a> |
| 178 |
</th> |
| 179 |
<th scope="col" id="title" class="manage-column column-title column-primary sortable <?php if ($this->get->get('orderby') == 'title') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>"> |
| 180 |
<a href="<?php |
| 181 |
if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { |
| 182 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc')); |
| 183 |
} else { |
| 184 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc')); |
| 185 |
} |
| 186 |
?>"> |
| 187 |
<span><?php _e('Title', 'e2pdf'); ?></span> |
| 188 |
<span class="sorting-indicator"></span> |
| 189 |
</a> |
| 190 |
</th> |
| 191 |
<th scope="col" id="item" class="manage-column column-item"><?php _e('Item', 'e2pdf'); ?></th> |
| 192 |
<th scope="col" id="shortcodes" class="manage-column column-shortcode"><?php _e('Shortcode', 'e2pdf'); ?></th> |
| 193 |
<th scope="col" id="updated" class="manage-column column-updated sortable <?php if ($this->get->get('orderby') == 'updated_at') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>"> |
| 194 |
<a href="<?php |
| 195 |
if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') { |
| 196 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc')); |
| 197 |
} else { |
| 198 |
echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc')); |
| 199 |
} |
| 200 |
?>"> |
| 201 |
<span><?php _e('Updated', 'e2pdf'); ?></span> |
| 202 |
<span class="sorting-indicator"> |
| 203 |
</span> |
| 204 |
</a> |
| 205 |
</th> |
| 206 |
<th scope="col" id="activation" class="manage-column column-activation"><?php _e('Activation', 'e2pdf'); ?></th> |
| 207 |
</tr> |
| 208 |
</tfoot> |
| 209 |
</table> |
| 210 |
<div class="tablenav bottom"> |
| 211 |
<?php |
| 212 |
if ($this->get->get('status') == 'trash') { |
| 213 |
$this->render('blocks', 'bulk-actions', array( |
| 214 |
'id' => 'doaction2', |
| 215 |
'name' => 'action2', |
| 216 |
'options' => array( |
| 217 |
'restore' => 'Restore', |
| 218 |
'delete' => 'Delete' |
| 219 |
) |
| 220 |
)); |
| 221 |
} else { |
| 222 |
$this->render('blocks', 'bulk-actions', array( |
| 223 |
'id' => 'doaction2', |
| 224 |
'name' => 'action2', |
| 225 |
'options' => array( |
| 226 |
'trash' => 'Move To Trash' |
| 227 |
) |
| 228 |
)); |
| 229 |
} |
| 230 |
$this->render('blocks', 'pagination', array( |
| 231 |
'total' => $this->controller->get_templates_list($this->get->get(), true), |
| 232 |
'limit' => get_option('e2pdf_templates_screen_per_page') && (int) get_option('e2pdf_templates_screen_per_page') > '0' ? get_option('e2pdf_templates_screen_per_page') : '20', |
| 233 |
'paged' => $this->get->get('paged') && (int) $this->get->get('paged') > '0' ? (int) $this->get->get('paged') : '1', |
| 234 |
'url' => array('page' => 'e2pdf-templates', 'action' => $this->get->get('action'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order')) |
| 235 |
)); |
| 236 |
?> |
| 237 |
<br class="clear"> |
| 238 |
</div> |
| 239 |
</form> |
| 240 |
<br class="clear"> |
| 241 |
<?php } elseif ($this->get->get('action')) { ?> |
| 242 |
<?php if ($this->get->get('action') === 'create' || ($this->get->get('action') === 'edit' && $this->view->template)) { ?> |
| 243 |
<h1><?php $this->get->get('action') === 'edit' ? _e('Edit Template', 'e2pdf') : _e('New Template', 'e2pdf'); ?> |
| 244 |
<a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action"> |
| 245 |
<?php _e('Add new', 'e2pdf') ?> |
| 246 |
</a> |
| 247 |
</h1> |
| 248 |
<hr class="wp-header-end"> |
| 249 |
<?php $this->render('blocks', 'notifications'); ?> |
| 250 |
<div id="poststuff"> |
| 251 |
<form method="post" id="e2pdf-build-form"> |
| 252 |
<div id="post-body" class="metabox-holder columns-2"> |
| 253 |
<div id="post-body-content"> |
| 254 |
<div class="e2pdf-form-builder"> |
| 255 |
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>"> |
| 256 |
<input type="hidden" name="sub_action" value="<?php echo $this->get->get('action') === 'create' ? 'create' : 'edit'; ?>"> |
| 257 |
<?php if ($this->view->template->get('ID')) { ?> |
| 258 |
<input type="hidden" name="ID" value="<?php echo $this->view->template->get('ID'); ?>"> |
| 259 |
<input type="hidden" name="width" value="<?php echo $this->view->template->get('width'); ?>"> |
| 260 |
<input type="hidden" name="height" value="<?php echo $this->view->template->get('height'); ?>"> |
| 261 |
<input type="hidden" name="extension" value="<?php echo $this->view->template->get('extension'); ?>"> |
| 262 |
<input type="hidden" name="item" value="<?php echo $this->view->template->get('item'); ?>"> |
| 263 |
<input type="hidden" name="pdf" value="<?php echo $this->view->template->get('pdf'); ?>"> |
| 264 |
<input type="hidden" name="format" value="<?php echo $this->view->template->get('format'); ?>"> |
| 265 |
<input type="hidden" name="activated" value="<?php echo $this->view->template->get('activated'); ?>"> |
| 266 |
<input type="hidden" name="templates_limit" value="<?php echo $this->view->license->get('templates_limit') - $this->view->license->get('active_templates'); ?>"> |
| 267 |
<?php } else { ?> |
| 268 |
<input type="hidden" name="activated" value="<?php echo $this->view->license->get('templates_limit') - $this->view->license->get('active_templates') > 0 ? '1' : '0' ?>"> |
| 269 |
<input type="hidden" name="templates_limit" value="<?php echo $this->view->license->get('templates_limit') - $this->view->license->get('active_templates'); ?>"> |
| 270 |
<?php } ?> |
| 271 |
<div id="e2pdf-build-form-wrapper"> |
| 272 |
<div id="e2pdf-form-editor-container" class="e2pdf-form-editor-container"> |
| 273 |
<div id="titlediv"> |
| 274 |
<?php |
| 275 |
$this->render('field', 'text', array( |
| 276 |
'field' => array( |
| 277 |
'id' => 'e2pdf-title', |
| 278 |
'name' => 'title', |
| 279 |
'placeholder' => __('Template Title', 'e2pdf'), |
| 280 |
'class' => 'e2pdf-w100' |
| 281 |
), |
| 282 |
'value' => $this->view->template->get('title'), |
| 283 |
)); |
| 284 |
?> |
| 285 |
</div> |
| 286 |
<?php |
| 287 |
$this->render('blocks', 'wysiwyg'); |
| 288 |
?> |
| 289 |
<div class="clear"></div> |
| 290 |
</div> |
| 291 |
<div class="e2pdf-tpl-wrapper"> |
| 292 |
<div id="e2pdf-tpl" class="e2pdf-tpl e2pdf-center" data-width="<?php echo $this->view->template->get('width'); ?>" data-height="<?php echo $this->view->template->get('height'); ?>"> |
| 293 |
<div id="e2pdf-tpl-inner" class="e2pdf-tpl-inner"> |
| 294 |
<?php if ($this->get->get('action') === 'edit') { ?> |
| 295 |
<?php $fonts = $this->view->template->get('fonts'); ?> |
| 296 |
<?php foreach ($fonts as $font_key => $font) { ?> |
| 297 |
<div class="e2pdf-load-font e2pdf-hide" path="<?php echo $font_key; ?>" name="<?php echo $font; ?>"></div> |
| 298 |
<?php } ?> |
| 299 |
<?php $pages = $this->view->template->get('pages'); ?> |
| 300 |
<?php foreach ($pages as $page_key => $page) { ?> |
| 301 |
<div data-page_id="<?php echo $page['page_id']; ?>" class="e2pdf-page ui-droppable e2pdf-load-page" data-width="<?php echo $page['properties']['width']; ?>" data-height="<?php echo $page['properties']['height']; ?>" style="width: <?php echo $page['properties']['width']; ?>px; height: <?php echo $page['properties']['height']; ?>px; <?php if ($this->view->template->get('pdf') && file_exists($this->helper->get('pdf_dir') . $this->view->template->get('pdf') . '/images/' . $page['page_id'] . '.png')) { ?>background-image: url('<?php echo $this->helper->get_upload_url('pdf/' . $this->view->template->get('pdf') . '/images/' . $page['page_id'] . '.png') ?>')<?php } ?>"> |
| 302 |
<div class="page-options-icons"><a href="javascript:void(0);" class="page-options-icon e2pdf-up-page e2pdf-link" <?php if ($page['page_id'] == '1' || $this->view->template->get('pdf')) { ?>disabled="disabled"<?php } ?>><i class="dashicons dashicons-arrow-up-alt2"></i></a><a href="javascript:void(0);" class="page-options-icon e2pdf-down-page e2pdf-link" <?php if ($page['page_id'] == count($pages) || $this->view->template->get('pdf')) { ?>disabled="disabled" <?php } ?>><i class="dashicons dashicons-arrow-down-alt2"></i></a><a href="javascript:void(0);" class="page-options-icon e2pdf-page-options e2pdf-modal e2pdf-link" data-modal="page-options"><i class="dashicons dashicons-admin-generic"></i></a><a href="javascript:void(0);" class="page-options-icon e2pdf-delete-page e2pdf-link"><i class="dashicons dashicons-no"></i></a></div> |
| 303 |
<?php foreach ($page['elements'] as $key => $value) { ?> |
| 304 |
<div class="e2pdf-load-el" data-width="<?php echo $value['width']; ?>" data-height="<?php echo $value['height']; ?>" data-top="<?php echo $value['top']; ?>" data-left="<?php echo $value['left']; ?>" data-type="<?php echo $value['type'] ?>" data-element_id="<?php echo $value['element_id'] ?>"><div class="e2pdf-data-name"><?php echo htmlspecialchars($value['name']) ?></div><div class="e2pdf-data-properties"><?php echo htmlspecialchars(json_encode($value['properties'], JSON_FORCE_OBJECT)); ?></div><div class="e2pdf-data-actions"><?php echo htmlspecialchars(json_encode($value['actions'], JSON_FORCE_OBJECT)); ?></div><div class="e2pdf-data-value"><?php echo $value['type'] === 'e2pdf-html' ? $value['value'] : htmlspecialchars($value['value']) ?></div></div> |
| 305 |
<?php } ?> |
| 306 |
<div class="e2pdf-data-actions e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['actions'], JSON_FORCE_OBJECT)); ?></div> |
| 307 |
<div class="e2pdf-data-properties e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['properties'], JSON_FORCE_OBJECT)); ?></div> |
| 308 |
<div class="e2pdf-guide e2pdf-guide-h"></div> |
| 309 |
<div class="e2pdf-guide e2pdf-guide-v"></div> |
| 310 |
</div> |
| 311 |
<?php } ?> |
| 312 |
<?php } ?> |
| 313 |
</div> |
| 314 |
</div> |
| 315 |
</div> |
| 316 |
<?php $this->render('blocks', 'bottom-panel'); ?> |
| 317 |
</div> |
| 318 |
</div> |
| 319 |
</div> |
| 320 |
<div id="postbox-container-1" class="postbox-container e2pdf-templates-meta-boxes"> |
| 321 |
<?php |
| 322 |
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
| 323 |
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
| 324 |
?> |
| 325 |
<?php |
| 326 |
do_meta_boxes(null, 'side', null); |
| 327 |
?> |
| 328 |
</div> |
| 329 |
</div> |
| 330 |
</form> |
| 331 |
</div> |
| 332 |
<?php } elseif ($this->get->get('action') === 'import') { ?> |
| 333 |
<h1><?php _e('Import', 'e2pdf'); ?></h1> |
| 334 |
<hr class="wp-header-end"> |
| 335 |
<?php $this->render('blocks', 'notifications'); ?> |
| 336 |
<div id="poststuff" class="e2pdf-view-area"> |
| 337 |
<form enctype="multipart/form-data" method="post"> |
| 338 |
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>"> |
| 339 |
<ul class="e2pdf-options-list"> |
| 340 |
<li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>: |
| 341 |
</div><div class="e2pdf-value"><input name="template" type="file"> |
| 342 |
<div class="e2pdf-note"><?php _e('Allowed filetypes', 'e2pdf'); ?>: <strong>.xml</strong></div> |
| 343 |
</div> |
| 344 |
</li> |
| 345 |
|
| 346 |
<?php foreach ($this->view->options as $group_key => $group) { ?> |
| 347 |
<?php if (isset($group['name'])) { ?> |
| 348 |
<li><h4><?php echo $group['name']; ?>:</h4></li> |
| 349 |
<?php } ?> |
| 350 |
<?php foreach ($group['options'] as $option_key => $option_value) { ?> |
| 351 |
<li class="<?php echo isset($option_value['li']['class']) ? $option_value['li']['class'] : '' ?>" > |
| 352 |
<div class="e2pdf-name"> |
| 353 |
<?php echo $option_value['name']; ?>: |
| 354 |
</div><div class="e2pdf-value"> |
| 355 |
<?php |
| 356 |
if ($option_value['type'] == 'checkbox') { |
| 357 |
$this->render('field', 'checkbox', array( |
| 358 |
'field' => array( |
| 359 |
'name' => $option_value['key'], |
| 360 |
'placeholder' => $option_value['placeholder'], |
| 361 |
'disabled' => isset($option_value['disabled']) && $option_value['disabled'] ? 'disabled' : false, |
| 362 |
'class' => isset($option_value['class']) ? $option_value['class'] : '', |
| 363 |
'data-collapse' => isset($option_value['data-collapse']) ? $option_value['data-collapse'] : '' |
| 364 |
), |
| 365 |
'value' => $option_value['value'], |
| 366 |
'checkbox_value' => 1, |
| 367 |
'default_value' => $option_value['default_value'], |
| 368 |
)); |
| 369 |
} elseif ($option_value['type'] == 'text') { |
| 370 |
$this->render('field', 'text', array( |
| 371 |
'field' => array( |
| 372 |
'name' => $option_value['key'], |
| 373 |
'placeholder' => $option_value['placeholder'], |
| 374 |
'class' => 'e2pdf-w100 ' . $option_value['class'] |
| 375 |
), |
| 376 |
'value' => $option_value['value'], |
| 377 |
)); |
| 378 |
} elseif ($option_value['type'] == 'textarea') { |
| 379 |
$this->render('field', 'textarea', array( |
| 380 |
'field' => array( |
| 381 |
'name' => $option_value['key'], |
| 382 |
'style' => 'height: 100px;', |
| 383 |
'class' => 'e2pdf-w100', |
| 384 |
'placeholder' => $option_value['placeholder'], |
| 385 |
), |
| 386 |
'value' => $option_value['value'], |
| 387 |
)); |
| 388 |
} elseif ($option_value['type'] == 'select') { |
| 389 |
$this->render('field', 'select', array( |
| 390 |
'field' => array( |
| 391 |
'name' => $option_value['key'], |
| 392 |
'class' => 'e2pdf-w100' |
| 393 |
), |
| 394 |
'value' => $option_value['value'], |
| 395 |
'options' => $option_value['options'] |
| 396 |
)); |
| 397 |
} elseif ($option_value['type'] == 'radio') { |
| 398 |
$this->render('field', 'radio', array( |
| 399 |
'field' => array( |
| 400 |
'name' => $option_value['key'], |
| 401 |
), |
| 402 |
'value' => $option_value['value'], |
| 403 |
'options' => $option_value['options'] |
| 404 |
)); |
| 405 |
} |
| 406 |
?> |
| 407 |
</div> |
| 408 |
</li> |
| 409 |
<?php } ?> |
| 410 |
<?php } ?> |
| 411 |
</ul> |
| 412 |
<p class="submit"><input type="submit" <?php if ($this->view->import_disabled) { ?>disabled="disabled"<?php } ?> name="submit" id="submit" class="button button-primary" value="<?php _e('Import', 'e2pdf'); ?>"></p> |
| 413 |
</form> |
| 414 |
</div> |
| 415 |
<?php } elseif ($this->get->get('action') === 'backup') { ?> |
| 416 |
<h1><?php _e('Backup', 'e2pdf'); ?></h1> |
| 417 |
<hr class="wp-header-end"> |
| 418 |
<?php $this->render('blocks', 'notifications'); ?> |
| 419 |
<div id="poststuff" class="e2pdf-view-area"> |
| 420 |
<form method="post"> |
| 421 |
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>"> |
| 422 |
<input type="hidden" name="id" value="<?php echo $this->get->get('id'); ?>"> |
| 423 |
<ul class="e2pdf-options-list"> |
| 424 |
<li><div class="e2pdf-name"><?php _e('Extension', 'e2pdf'); ?>: |
| 425 |
</div><div class="e2pdf-value"> |
| 426 |
<?php if ($this->view->template->extension()->method('info')) { ?> |
| 427 |
<?php echo $this->view->template->extension()->info('title'); ?> |
| 428 |
<?php } ?> |
| 429 |
</div> |
| 430 |
</li> |
| 431 |
<li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>: |
| 432 |
</div><div class="e2pdf-value"> |
| 433 |
<a target="_blank" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $this->view->template->get('ID'))); ?>"><?php echo $this->view->template->get('title'); ?></a> |
| 434 |
</div> |
| 435 |
</li> |
| 436 |
<li><div class="e2pdf-name"><?php _e('Item', 'e2pdf'); ?>: |
| 437 |
</div><div class="e2pdf-value"> |
| 438 |
<?php if ($this->view->template->extension()->method('item') && $this->view->template->get('item')) { ?><a target="_blank" href="<?php echo $this->view->template->extension()->item()->url; ?>"><?php echo $this->view->template->extension()->item()->name; ?></a><?php } else { ?>—<?php } ?> |
| 439 |
</div> |
| 440 |
</li> |
| 441 |
<?php foreach ($this->view->options as $group_key => $group) { ?> |
| 442 |
<?php if (isset($group['name'])) { ?> |
| 443 |
<li><h4><?php echo $group['name']; ?>:</h4></li> |
| 444 |
<?php } ?> |
| 445 |
<?php foreach ($group['options'] as $option_key => $option_value) { ?> |
| 446 |
<li> |
| 447 |
<div class="e2pdf-name"> |
| 448 |
<?php echo $option_value['name']; ?>: |
| 449 |
</div><div class="e2pdf-value"> |
| 450 |
<?php |
| 451 |
if ($option_value['type'] == 'checkbox') { |
| 452 |
$this->render('field', 'checkbox', array( |
| 453 |
'field' => array( |
| 454 |
'name' => $option_value['key'], |
| 455 |
'placeholder' => $option_value['placeholder'], |
| 456 |
'disabled' => isset($option_value['disabled']) && $option_value['disabled'] ? 'disabled' : false |
| 457 |
), |
| 458 |
'value' => $option_value['value'], |
| 459 |
'checkbox_value' => 1, |
| 460 |
'default_value' => $option_value['default_value'], |
| 461 |
)); |
| 462 |
} elseif ($option_value['type'] == 'text') { |
| 463 |
$this->render('field', 'text', array( |
| 464 |
'field' => array( |
| 465 |
'name' => $option_value['key'], |
| 466 |
'placeholder' => $option_value['placeholder'], |
| 467 |
'class' => 'e2pdf-w100 ' . $option_value['class'] |
| 468 |
), |
| 469 |
'value' => $option_value['value'], |
| 470 |
)); |
| 471 |
} elseif ($option_value['type'] == 'textarea') { |
| 472 |
$this->render('field', 'textarea', array( |
| 473 |
'field' => array( |
| 474 |
'name' => $option_value['key'], |
| 475 |
'style' => 'height: 100px;', |
| 476 |
'class' => 'e2pdf-w100', |
| 477 |
'placeholder' => $option_value['placeholder'], |
| 478 |
), |
| 479 |
'value' => $option_value['value'], |
| 480 |
)); |
| 481 |
} elseif ($option_value['type'] == 'select') { |
| 482 |
$this->render('field', 'select', array( |
| 483 |
'field' => array( |
| 484 |
'name' => $option_value['key'], |
| 485 |
'class' => 'e2pdf-w100' |
| 486 |
), |
| 487 |
'value' => $option_value['value'], |
| 488 |
'options' => $option_value['options'] |
| 489 |
)); |
| 490 |
} |
| 491 |
?> |
| 492 |
</div> |
| 493 |
</li> |
| 494 |
<?php } ?> |
| 495 |
<?php } ?> |
| 496 |
</ul> |
| 497 |
<p class="submit"><input type="submit" <?php if ($this->view->export_disabled) { ?>disabled="disabled"<?php } ?> name="submit" id="submit" class="button button-primary" value="<?php _e('Download', 'e2pdf'); ?>"></p> |
| 498 |
</form> |
| 499 |
</div> |
| 500 |
<?php } ?> |
| 501 |
<?php } else { ?> |
| 502 |
<?php $this->error(); ?> |
| 503 |
<?php } ?> |
| 504 |
</div> |
| 505 |
<?php $this->render('blocks', 'debug-panel'); ?> |