PluginProbe
E2Pdf – Export Pdf Tool for WordPress / trunk
E2Pdf – Export Pdf Tool for WordPress vtrunk
1.32.48 1.32.43 1.32.40 1.32.34 1.32.32 1.32.31 1.32.26 1.32.22 1.32.23 1.32.18 1.32.17 1.32.15 trunk 1.00.00 1.00.13 1.01.01 1.02.02 1.03.07 1.04.07 1.05.03 1.06.02 1.07.11 1.08.00 1.08.06 1.08.09 All 71 releases
e2pdf / classes / view / page-e2pdf-templates.php

page-e2pdf-templates.php in E2Pdf – Export Pdf Tool for WordPress trunk, at classes/view/page-e2pdf-templates.php

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