コード例 #1
0
 /**
  * Add generic admin interface assets.
  *
  * @since 1.1.0
  */
 private function add_admin_assets()
 {
     foreach (H5PCore::$adminScripts as $script) {
         H5P_Plugin_Admin::add_script('admin-' . $script, 'h5p-php-library/' . $script);
     }
     H5P_Plugin_Admin::add_style('h5p', 'h5p-php-library/styles/h5p.css');
     H5P_Plugin_Admin::add_style('admin', 'h5p-php-library/styles/h5p-admin.css');
 }
コード例 #2
0
 /**
  * Provide data for content results view.
  *
  * @since 1.2.0
  */
 public function ajax_content_results()
 {
     $id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
     if (!$id) {
         return;
         // Missing id
     }
     $plugin = H5P_Plugin::get_instance();
     $content = $plugin->get_content($id);
     if (is_string($content) || !$this->current_user_can_edit($content)) {
         return;
         // Error loading content or no access
     }
     $plugin_admin = H5P_Plugin_Admin::get_instance();
     $plugin_admin->print_results($id);
 }
コード例 #3
0
 /**
  * Print settings, adds JavaScripts and stylesheets necessary for providing
  * a data view.
  *
  * @since 1.2.0
  * @param string $name of the data view
  * @param string $source URL for data
  * @param array $headers for the table
  */
 public function print_data_view_settings($name, $source, $headers, $filters, $empty, $order)
 {
     // Add JS settings
     $data_views = array();
     $data_views[$name] = array('source' => $source, 'headers' => $headers, 'filters' => $filters, 'order' => $order, 'l10n' => array('loading' => __('Loading data.', $this->plugin_slug), 'ajaxFailed' => __('Failed to load data.', $this->plugin_slug), 'noData' => __("There's no data available that matches your criteria.", $this->plugin_slug), 'currentPage' => __('Page $current of $total', $this->plugin_slug), 'nextPage' => __('Next page', $this->plugin_slug), 'previousPage' => __('Previous page', $this->plugin_slug), 'search' => __('Search', $this->plugin_slug), 'empty' => $empty));
     $plugin = H5P_Plugin::get_instance();
     $settings = array('dataViews' => $data_views);
     $plugin->print_settings($settings);
     // Add JS
     H5P_Plugin_Admin::add_script('jquery', 'h5p-php-library/js/jquery.js');
     H5P_Plugin_Admin::add_script('utils', 'h5p-php-library/js/h5p-utils.js');
     H5P_Plugin_Admin::add_script('data-view', 'h5p-php-library/js/h5p-data-view.js');
     H5P_Plugin_Admin::add_script('data-views', 'admin/scripts/h5p-data-views.js');
     H5P_Plugin_Admin::add_style('admin', 'h5p-php-library/styles/h5p-admin.css');
 }
コード例 #4
0
<?php

/**
 * List library details.
 *
 * @package   H5P
 * @author    Joubel <*****@*****.**>
 * @license   MIT
 * @link      http://joubel.com
 * @copyright 2014 Joubel
 */
?>

<div class="wrap">
  <h2><?php 
print esc_html($library->title);
?>
</h2>
  <?php 
print H5P_Plugin_Admin::print_messages();
?>
  <div id="h5p-admin-container"></div>
</div>