public/wordpress/wp-content/plugins/h5p/admin/class-h5p-content-admin.php
/**
   * Display a list of all h5p content.
   *
   * @since 1.1.0
   */
Display a list of all h5p content.
Display a list of all h5p content .
public function display_contents_page() {
    switch (filter_input(INPUT_GET, 'task', FILTER_SANITIZE_STRING)) {
      case NULL:
        include_once('views/contents.php');
        $headers = array(
          (object) array(
            'text' => __('Title', $this->plugin_slug),
            'sortable' => TRUE
          ),
          (object) array(
            'text' => __('Content type', $this->plugin_slug),
            'sortable' => TRUE,
            'facet' => TRUE
          ),
          (object) array(
            'text' => __('Author', $this->plugin_slug),
            'sortable' => TRUE,
            'facet' => TRUE
          ),
          (object) array(
            'text' => __('Tags', $this->plugin_slug),
            'sortable' => FALSE,
            'facet' => TRUE
          ),
          (object) array(
            'text' => __('Last modified', $this->plugin_slug),
            'sortable' => TRUE
          ),
          (object) array(
            'text' => __('ID', $this->plugin_slug),
            'sortable' => TRUE
          )
        );
        if (get_option('h5p_track_user', TRUE)) {
          $headers[] = (object) array(
            'class' => 'h5p-results-link'
          );
        }
        $headers[] = (object) array(
          'class' => 'h5p-edit-link'
        );
        $plugin_admin = H5P_Plugin_Admin::get_instance();
        $plugin_admin->print_data_view_settings(
          'h5p-contents',
          admin_url('admin-ajax.php?action=h5p_contents'),
          $headers,
          array(true),
          __("No H5P content available. You must upload or create new content.", $this->plugin_slug),
          (object) array(
            'by' => 4,
            'dir' => 0
          )
        );
        return;
      case 'show':
        if (is_string($this->content)) {
          H5P_Plugin_Admin::set_error($this->content);
          H5P_Plugin_Admin::print_messages();
        }
        else {
          $plugin = H5P_Plugin::get_instance();
          $embed_code = $plugin->add_assets($this->content);
          include_once('views/show-content.php');
          H5P_Plugin::get_instance()->add_settings();
          new H5P_Event('content', NULL,
              $this->content['id'],
              $this->content['title'],
              $this->content['library']['name'],
              $this->content['library']['majorVersion'] . '.' . $this->content['library']['minorVersion']);
        }
        return;
      case 'results':
        if (is_string($this->content)) {
          H5P_Plugin_Admin::set_error($this->content);
          H5P_Plugin_Admin::print_messages();
        }
        else {
          include_once('views/content-results.php');
          $plugin_admin = H5P_Plugin_Admin::get_instance();
          $plugin_admin->print_data_view_settings(
            'h5p-content-results',
            admin_url('admin-ajax.php?action=h5p_content_results&id=' . $this->content['id']),
            array(
              (object) array(
                'text' => __('User', $this->plugin_slug),
                'sortable' => TRUE
              ),
              (object) array(
                'text' => __('Score', $this->plugin_slug),
                'sortable' => TRUE
              ),
              (object) array(
                'text' => __('Maximum Score', $this->plugin_slug),
                'sortable' => TRUE
              ),
              (object) array(
                'text' => __('Opened', $this->plugin_slug),
                'sortable' => TRUE
              ),
              (object) array(
                'text' => __('Finished', $this->plugin_slug),
                'sortable' => TRUE
              ),
              __('Time spent', $this->plugin_slug)
            ),
            array(true),
            __("There are no logged results for this content.", $this->plugin_slug),
            (object) array(
              'by' => 4,
              'dir' => 0
            )
          );
          new H5P_Event('results', 'content',
              $this->content['id'],
              $this->content['title'],
              $this->content['library']['name'],
              $this->content['library']['majorVersion'] . '.' . $this->content['library']['minorVersion']);
        }
        return;
    }
    print '<div class="wrap"><h2>' . esc_html__('Unknown task.', $this->plugin_slug) . '</h2></div>';
  }
public function display_contents_page ( ) { switch ( filter_input ( INPUT_GET , 'task' , FILTER_SANITIZE_STRING ) ) { case NULL : include_once ( 'views/contents.php' ) ; $ headers = array ( ( object ) array ( 'text' => __ ( 'Title' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , ( object ) array ( 'text' => __ ( 'Content type' , $ this -> plugin_slug ) , 'sortable' => TRUE , 'facet' => TRUE ) , ( object ) array ( 'text' => __ ( 'Author' , $ this -> plugin_slug ) , 'sortable' => TRUE , 'facet' => TRUE ) , ( object ) array ( 'text' => __ ( 'Tags' , $ this -> plugin_slug ) , 'sortable' => FALSE , 'facet' => TRUE ) , ( object ) array ( 'text' => __ ( 'Last modified' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , ( object ) array ( 'text' => __ ( 'ID' , $ this -> plugin_slug ) , 'sortable' => TRUE ) ) ; if ( get_option ( 'h5p_track_user' , TRUE ) ) { $ headers [ ] = ( object ) array ( 'class' => 'h5p-results-link' ) ; } $ headers [ ] = ( object ) array ( 'class' => 'h5p-edit-link' ) ; $ plugin_admin = H5P_Plugin_Admin :: get_instance ( ) ; $ plugin_admin -> print_data_view_settings ( 'h5p-contents' , admin_url ( 'admin-ajax.php?action=h5p_contents' ) , $ headers , array ( true ) , __ ( " No H5P content available. You must upload or create new content. " , $ this -> plugin_slug ) , ( object ) array ( 'by' => 4 , 'dir' => 0 ) ) ; return ; case 'show' : if ( is_string ( $ this -> content ) ) { H5P_Plugin_Admin :: set_error ( $ this -> content ) ; H5P_Plugin_Admin :: print_messages ( ) ; } else { $ plugin = H5P_Plugin :: get_instance ( ) ; $ embed_code = $ plugin -> add_assets ( $ this -> content ) ; include_once ( 'views/show-content.php' ) ; H5P_Plugin :: get_instance ( ) -> add_settings ( ) ; new H5P_Event ( 'content' , NULL , $ this -> content [ 'id' ] , $ this -> content [ 'title' ] , $ this -> content [ 'library' ] [ 'name' ] , $ this -> content [ 'library' ] [ 'majorVersion' ] . '.' . $ this -> content [ 'library' ] [ 'minorVersion' ] ) ; } return ; case 'results' : if ( is_string ( $ this -> content ) ) { H5P_Plugin_Admin :: set_error ( $ this -> content ) ; H5P_Plugin_Admin :: print_messages ( ) ; } else { include_once ( 'views/content-results.php' ) ; $ plugin_admin = H5P_Plugin_Admin :: get_instance ( ) ; $ plugin_admin -> print_data_view_settings ( 'h5p-content-results' , admin_url ( 'admin-ajax.php?action=h5p_content_results&id=' . $ this -> content [ 'id' ] ) , array ( ( object ) array ( 'text' => __ ( 'User' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , ( object ) array ( 'text' => __ ( 'Score' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , ( object ) array ( 'text' => __ ( 'Maximum Score' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , ( object ) array ( 'text' => __ ( 'Opened' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , ( object ) array ( 'text' => __ ( 'Finished' , $ this -> plugin_slug ) , 'sortable' => TRUE ) , __ ( 'Time spent' , $ this -> plugin_slug ) ) , array ( true ) , __ ( " There are no logged results for this content. " , $ this -> plugin_slug ) , ( object ) array ( 'by' => 4 , 'dir' => 0 ) ) ; new H5P_Event ( 'results' , 'content' , $ this -> content [ 'id' ] , $ this -> content [ 'title' ] , $ this -> content [ 'library' ] [ 'name' ] , $ this -> content [ 'library' ] [ 'majorVersion' ] . '.' . $ this -> content [ 'library' ] [ 'minorVersion' ] ) ; } return ; } print '<div class="wrap"><h2>' . esc_html__ ( 'Unknown task.' , $ this -> plugin_slug ) . '</h2></div>' ; }
Display a list of all h5p content.
Display a list of all h5p content .
// Admin preview of H5P content. // Log view // View content results // Print HTML // Log content result view