WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
wpdk-preferences-viewcontroller.php
Go to the documentation of this file.
1 <?php
2 
14 
22  private $preferences;
23 
35  public function __construct( $preferences, $title, $tabs )
36  {
37  $this->preferences = $preferences;
38  $view = new WPDKjQueryTabsView( $preferences->name, $tabs );
39  parent::__construct( $preferences->name, $title, $view );
40 
41  // Provide a reset all button
42  add_action( 'wpdk_header_view_' . $this->id . '-header-view_after_title', array( $this, 'display_toolbar' ) );
43  }
44 
52  public function _admin_head()
53  {
55  }
56 
57 
63  public function display_toolbar()
64  {
65  $confirm = __( "Are you sure to reset All preferences to default value?\n\nThis operation is not reversible!", WPDK_TEXTDOMAIN );
66  $confirm = apply_filters( 'wpdk_preferences_reset_all_confirm_message', $confirm );
67  ?>
68  <div class="tablenav top">
69  <form id="wpdk-preferences"
70  enctype="multipart/form-data"
71  method="post">
72 
73  <input type="hidden"
74  name="wpdk_preferences_class"
75  value="<?php echo get_class( $this->preferences ) ?>" />
76  <input type="file" name="file" />
77  <input type="submit"
78  name="wpdk_preferences_import"
79  class="button button-primary"
80  value="<?php _e( 'Import', WPDK_TEXTDOMAIN ) ?>" />
81 
82  <input type="submit"
83  name="wpdk_preferences_export"
84  class="button button-secondary"
85  value="<?php _e( 'Export', WPDK_TEXTDOMAIN ) ?>" />
86 
87  <input type="submit"
88  name="wpdk_preferences_reset_all"
89  class="button button-primary right"
90  data-confirm="<?php echo $confirm ?>"
91  value="<?php _e( 'Reset All', WPDK_TEXTDOMAIN ) ?>" />
92 
93  <?php do_action( 'wpdk_preferences_view_controller-' . $this->id . '-tablenav-top', $this ) ?>
94  </form>
95  </div>
96  <?php
97  }
98 
99 }