1: <?php
2:
3: 4: 5:
6: class Quform_Admin_Page_Tools_ExportForm extends Quform_Admin_Page_Tools
7: {
8: 9: 10:
11: protected $repository;
12:
13:
14: public function init()
15: {
16: $this->template = QUFORM_TEMPLATE_PATH . '/admin/tools/export-form.php';
17: }
18:
19: 20: 21:
22: protected function enqueueScripts()
23: {
24: parent::enqueueScripts();
25:
26: wp_enqueue_script('quform-tools-export-form', Quform::adminUrl('js/tools.export-form.min.js'), array('jquery'), QUFORM_VERSION, true);
27: wp_localize_script('quform-tools-export-form', 'quformToolsExportFormL10n', $this->getScriptL10n());
28: }
29:
30: 31: 32: 33: 34:
35: protected function getScriptL10n()
36: {
37: return array(
38: 'exportFormNonce' => wp_create_nonce('quform_export_form'),
39: 'errorExportingForm' => __('An error occurred exporting the form', 'quform'),
40: 'noFormSelected' => __('No form selected', 'quform')
41: );
42: }
43:
44: 45: 46: 47: 48:
49: protected function getAdminTitle()
50: {
51: return __('Export Form', 'quform');
52: }
53:
54: 55: 56: 57: 58: 59: 60:
61: public function getNavHtml(array $currentForm = null, array $extra = array())
62: {
63: $extra[40] = sprintf(
64: '<div class="qfb-nav-item qfb-nav-page-info"><i class="qfb-nav-page-icon qfb-icon-file-code-o"></i><span class="qfb-nav-page-title">%s</span></div>',
65: esc_html__('Export form', 'quform')
66: );
67:
68: return parent::getNavHtml($currentForm, $extra);
69: }
70:
71: 72: 73:
74: public function process()
75: {
76: if ( ! current_user_can('quform_export_forms')) {
77: wp_die(__( 'You do not have sufficient permissions to access this page.', 'quform'), 403);
78: }
79:
80: $orderBy = get_user_meta(get_current_user_id(), 'quform_forms_order_by', true);
81: $order = get_user_meta(get_current_user_id(), 'quform_forms_order', true);
82:
83: $this->view->with(array(
84: 'forms' => $this->repository->formsToSelectArray(null, $orderBy, $order)
85: ));
86: }
87: }
88: