PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.03.07
E2Pdf – Export Pdf Tool for WordPress v1.03.07
1.32.49 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 All 72 releases
e2pdf / classes / view / page-e2pdf-templates.php

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

483 lines 40.5 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 <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',
31 'delete' => 'Delete'
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'
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" 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" 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" 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" 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 <?php if ($template->get('activated')) { ?>
154 <a class="e2pdf-color-green" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'deactivate', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>"><?php _e('Activated', 'e2pdf'); ?></a>
155 <?php } else { ?>
156 <a class="e2pdf-color-red" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'activate', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>"><?php _e('Not Activated', 'e2pdf'); ?></a>
157 <?php } ?>
158 </td>
159 </tr>
160 <?php } ?>
161 <?php } ?>
162 </tbody>
163 <tfoot>
164 <tr>
165 <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>
166 <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 } ?>">
167 <a href="<?php
168 if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') {
169 echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc'));
170 } else {
171 echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc'));
172 }
173 ?>">
174 <span><?php _e('ID', 'e2pdf'); ?></span>
175 <span class="sorting-indicator"></span>
176 </a>
177 </th>
178 <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 } ?>">
179 <a href="<?php
180 if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') {
181 echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc'));
182 } else {
183 echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc'));
184 }
185 ?>">
186 <span><?php _e('Title', 'e2pdf'); ?></span>
187 <span class="sorting-indicator"></span>
188 </a>
189 </th>
190 <th scope="col" id="item" class="manage-column column-item"><?php _e('Item', 'e2pdf'); ?></th>
191 <th scope="col" id="shortcodes" class="manage-column column-shortcode"><?php _e('Shortcode', 'e2pdf'); ?></th>
192 <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 } ?>">
193 <a href="<?php
194 if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') {
195 echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc'));
196 } else {
197 echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc'));
198 }
199 ?>">
200 <span><?php _e('Updated', 'e2pdf'); ?></span>
201 <span class="sorting-indicator">
202 </span>
203 </a>
204 </th>
205 <th scope="col" id="activation" class="manage-column column-activation"><?php _e('Activation', 'e2pdf'); ?></th>
206 </tr>
207 </tfoot>
208 </table>
209 <div class="tablenav bottom">
210 <?php
211 if ($this->get->get('status') == 'trash') {
212 $this->render('blocks', 'bulk-actions', array(
213 'id' => 'doaction2',
214 'name' => 'action2',
215 'options' => array(
216 'restore' => 'Restore',
217 'delete' => 'Delete'
218 )
219 ));
220 } else {
221 $this->render('blocks', 'bulk-actions', array(
222 'id' => 'doaction2',
223 'name' => 'action2',
224 'options' => array(
225 'trash' => 'Move To Trash'
226 )
227 ));
228 }
229 ?>
230 <br class="clear">
231 </div>
232 </form>
233 <br class="clear">
234 <?php } elseif ($this->get->get('action')) { ?>
235 <?php if ($this->get->get('action') === 'create' || ($this->get->get('action') === 'edit' && $this->view->template)) { ?>
236 <h1><?php $this->get->get('action') === 'edit' ? _e('Edit Template', 'e2pdf') : _e('New Template', 'e2pdf'); ?>
237 <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
238 <?php _e('Add new', 'e2pdf') ?>
239 </a>
240 </h1>
241 <hr class="wp-header-end">
242 <?php $this->render('blocks', 'notifications'); ?>
243 <div id="poststuff">
244 <form method="post" id="e2pdf_build_form">
245 <div id="post-body" class="metabox-holder columns-2">
246 <div id="post-body-content">
247 <div class="e2pdf-form-builder">
248 <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
249 <input type="hidden" name="sub_action" value="<?php echo $this->get->get('action') === 'create' ? 'create' : 'edit'; ?>">
250 <?php if ($this->view->template->get('ID')) { ?>
251 <input type="hidden" name="ID" value="<?php echo $this->view->template->get('ID'); ?>">
252 <input type="hidden" name="width" value="<?php echo $this->view->template->get('width'); ?>">
253 <input type="hidden" name="height" value="<?php echo $this->view->template->get('height'); ?>">
254 <input type="hidden" name="extension" value="<?php echo $this->view->template->get('extension'); ?>">
255 <input type="hidden" name="item" value="<?php echo $this->view->template->get('item'); ?>">
256 <input type="hidden" name="pdf" value="<?php echo $this->view->template->get('pdf'); ?>">
257 <input type="hidden" name="format" value="<?php echo $this->view->template->get('format'); ?>">
258
259 <?php } ?>
260 <div id="e2pdf_build_form">
261 <div id="e2pdf-form-editor-container" class="e2pdf-form-editor-container">
262 <div id="titlediv">
263 <?php
264 $this->render('field', 'text', array(
265 'field' => array(
266 'name' => 'title',
267 'placeholder' => 'Enter title here'
268 ),
269 'value' => $this->view->template->get('title'),
270 'id' => 'title',
271 ));
272 ?>
273 </div>
274 <?php
275 $this->render('blocks', 'wysiwyg');
276 ?>
277 <div class="clear"></div>
278 </div>
279 <div class="e2pdf-tpl-wrapper">
280 <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'); ?>">
281 <div id="e2pdf-tpl-inner" class="e2pdf-tpl-inner">
282 <?php if ($this->get->get('action') === 'edit') { ?>
283 <?php $fonts = $this->view->template->get('fonts'); ?>
284 <?php foreach ($fonts as $font_key => $font) { ?>
285 <div class="e2pdf-load-font e2pdf-hide" path="<?php echo $font_key; ?>" name="<?php echo $font; ?>"></div>
286 <?php } ?>
287 <?php $pages = $this->view->template->get('pages'); ?>
288 <?php foreach ($pages as $page_key => $page) { ?>
289 <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 } ?>">
290 <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>
291 <?php foreach ($page['elements'] as $key => $value) { ?>
292 <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-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>
293 <?php } ?>
294 <div class="e2pdf-data-actions e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['actions'], JSON_FORCE_OBJECT)); ?></div>
295 <div class="e2pdf-data-properties e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['properties'], JSON_FORCE_OBJECT)); ?></div>
296 <div class="e2pdf-guide e2pdf-guide-h"></div>
297 <div class="e2pdf-guide e2pdf-guide-v"></div>
298 </div>
299 <?php } ?>
300 <?php } ?>
301 </div>
302 </div>
303 </div>
304 <?php $this->render('blocks', 'bottom-panel'); ?>
305 </div>
306 </div>
307 </div>
308 <div id="postbox-container-1" class="postbox-container e2pdf-templates-meta-boxes">
309 <?php
310 wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
311 wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
312 ?>
313 <?php
314 do_meta_boxes(null, 'side', null);
315 ?>
316 </div>
317 </div>
318 </form>
319 </div>
320 <?php } elseif ($this->get->get('action') === 'import') { ?>
321 <h1><?php _e('Import', 'e2pdf'); ?></h1>
322 <hr class="wp-header-end">
323 <?php $this->render('blocks', 'notifications'); ?>
324 <div id="poststuff" class="e2pdf-view-area">
325 <form enctype="multipart/form-data" method="post">
326 <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
327 <ul class="e2pdf-options-list">
328 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
329 </div><div class="e2pdf-value"><input name="template" type="file">
330 <div class="e2pdf-note"><?php _e('Allowed filetypes', 'e2pdf'); ?>: <strong>.xml</strong></div>
331 </div>
332 </li>
333
334 <?php foreach ($this->view->options as $group_key => $group) { ?>
335 <?php if (isset($group['name'])) { ?>
336 <li><h4><?php echo $group['name']; ?>:</h4></li>
337 <?php } ?>
338 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
339 <li>
340 <div class="e2pdf-name">
341 <?php echo $option_value['name']; ?>:
342 </div><div class="e2pdf-value">
343 <?php
344 if ($option_value['type'] == 'checkbox') {
345 $this->render('field', 'checkbox', array(
346 'field' => array(
347 'name' => $option_value['key'],
348 'placeholder' => $option_value['placeholder'],
349 'disabled' => isset($option_value['disabled']) && $option_value['disabled'] ? 'disabled' : false
350 ),
351 'value' => $option_value['value'],
352 'checkbox_value' => 1,
353 'default_value' => $option_value['default_value'],
354 ));
355 } elseif ($option_value['type'] == 'text') {
356 $this->render('field', 'text', array(
357 'field' => array(
358 'name' => $option_value['key'],
359 'placeholder' => $option_value['placeholder'],
360 'class' => 'e2pdf-w100 ' . $option_value['class']
361 ),
362 'value' => $option_value['value'],
363 ));
364 } elseif ($option_value['type'] == 'textarea') {
365 $this->render('field', 'textarea', array(
366 'field' => array(
367 'name' => $option_value['key'],
368 'style' => 'height: 100px;',
369 'class' => 'e2pdf-w100',
370 'placeholder' => $option_value['placeholder'],
371 ),
372 'value' => $option_value['value'],
373 ));
374 } elseif ($option_value['type'] == 'select') {
375 $this->render('field', 'select', array(
376 'field' => array(
377 'name' => $option_value['key'],
378 'class' => 'e2pdf-w100'
379 ),
380 'value' => $option_value['value'],
381 'options' => $option_value['options']
382 ));
383 }
384 ?>
385 </div>
386 </li>
387 <?php } ?>
388 <?php } ?>
389 </ul>
390 <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>
391 </form>
392 </div>
393 <?php } elseif ($this->get->get('action') === 'backup') { ?>
394 <h1><?php _e('Backup', 'e2pdf'); ?></h1>
395 <hr class="wp-header-end">
396 <?php $this->render('blocks', 'notifications'); ?>
397 <div id="poststuff" class="e2pdf-view-area">
398 <form method="post">
399 <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
400 <input type="hidden" name="id" value="<?php echo $this->get->get('id'); ?>">
401 <ul class="e2pdf-options-list">
402 <li><div class="e2pdf-name"><?php _e('Extension', 'e2pdf'); ?>:
403 </div><div class="e2pdf-value">
404 <?php if ($this->view->template->extension()->method('info')) { ?>
405 <?php echo $this->view->template->extension()->info('title'); ?>
406 <?php } ?>
407 </div>
408 </li>
409 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
410 </div><div class="e2pdf-value">
411 <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>
412 </div>
413 </li>
414 <li><div class="e2pdf-name"><?php _e('Item', 'e2pdf'); ?>:
415 </div><div class="e2pdf-value">
416 <?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 } ?>
417 </div>
418 </li>
419 <?php foreach ($this->view->options as $group_key => $group) { ?>
420 <?php if (isset($group['name'])) { ?>
421 <li><h4><?php echo $group['name']; ?>:</h4></li>
422 <?php } ?>
423 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
424 <li>
425 <div class="e2pdf-name">
426 <?php echo $option_value['name']; ?>:
427 </div><div class="e2pdf-value">
428 <?php
429 if ($option_value['type'] == 'checkbox') {
430 $this->render('field', 'checkbox', array(
431 'field' => array(
432 'name' => $option_value['key'],
433 'placeholder' => $option_value['placeholder'],
434 'disabled' => isset($option_value['disabled']) && $option_value['disabled'] ? 'disabled' : false
435 ),
436 'value' => $option_value['value'],
437 'checkbox_value' => 1,
438 'default_value' => $option_value['default_value'],
439 ));
440 } elseif ($option_value['type'] == 'text') {
441 $this->render('field', 'text', array(
442 'field' => array(
443 'name' => $option_value['key'],
444 'placeholder' => $option_value['placeholder'],
445 'class' => 'e2pdf-w100 ' . $option_value['class']
446 ),
447 'value' => $option_value['value'],
448 ));
449 } elseif ($option_value['type'] == 'textarea') {
450 $this->render('field', 'textarea', array(
451 'field' => array(
452 'name' => $option_value['key'],
453 'style' => 'height: 100px;',
454 'class' => 'e2pdf-w100',
455 'placeholder' => $option_value['placeholder'],
456 ),
457 'value' => $option_value['value'],
458 ));
459 } elseif ($option_value['type'] == 'select') {
460 $this->render('field', 'select', array(
461 'field' => array(
462 'name' => $option_value['key'],
463 'class' => 'e2pdf-w100'
464 ),
465 'value' => $option_value['value'],
466 'options' => $option_value['options']
467 ));
468 }
469 ?>
470 </div>
471 </li>
472 <?php } ?>
473 <?php } ?>
474 </ul>
475 <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>
476 </form>
477 </div>
478 <?php } ?>
479 <?php } else { ?>
480 <?php $this->error(); ?>
481 <?php } ?>
482 </div>
483 <?php $this->render('blocks', 'debug-panel'); ?>