'', 'name' => __('Name', 'wp-adv-quiz'), 'category' => __('Category', 'wp-adv-quiz'), 'shortcode' => __('Shortcode', 'wp-adv-quiz'), 'shortcode_leaderboard' => __('Shortcode-Leaderboard', 'wp-adv-quiz') ); return $columns; } function __construct($quizItems, $quizCount, $categoryItems, $perPage) { parent::__construct(array( 'singular' => __('Quiz', 'wp-adv-quiz'), 'plural' => __('Quiz', 'wp-adv-quiz'), 'ajax' => false, 'screen' => 'toplevel_page_wpproquiz' )); $this->quizItems = $quizItems; $this->quizCount = $quizCount; $this->categoryItems = $categoryItems; $this->perPage = $perPage; } function no_items() { _e('No data available', 'wp-adv-quiz'); } function column_default($item, $column_name) { return isset($item[$column_name]) ? $item[$column_name] : ''; } function get_sortable_columns() { $sortable_columns = array( 'name' => array('name', false), 'category' => array('category', false), ); return $sortable_columns; } function get_columns() { return get_column_headers(get_current_screen()); } function column_name($item) { $actions = array( 'wpAdvQuiz_questions' => sprintf('' . __('Questions', 'wp-adv-quiz') . '', $item['ID']), ); if (current_user_can('wpAdvQuiz_edit_quiz')) { $actions['wpAdvQuiz_edit'] = sprintf('' . __('Edit', 'wp-adv-quiz') . '', $item['ID']); } if (current_user_can('wpAdvQuiz_delete_quiz')) { $actions['wpAdvQuiz_delete'] = sprintf('' . __('Delete', 'wp-adv-quiz') . '', $item['ID']); } $actions['wpAdvQuiz_preview'] = sprintf('' . __('Preview', 'wp-adv-quiz') . '', $item['ID']); if (current_user_can('wpAdvQuiz_show_statistics')) { $actions['wpAdvQuiz_statistics'] = sprintf('' . __('Statistics', 'wp-adv-quiz') . '', $item['ID']); } if (current_user_can('wpAdvQuiz_toplist_edit')) { $actions['wpAdvQuiz_leaderboard'] = sprintf('' . __('Leaderboard', 'wp-adv-quiz') . '', $item['ID']); } return sprintf('%2$s %3$s', $item['ID'], $item['name'], $this->row_actions($actions)); } function get_bulk_actions() { $actions = array(); if (current_user_can('wpAdvQuiz_delete_quiz')) { $actions['delete'] = __('Delete', 'wp-adv-quiz'); } if (current_user_can('wpAdvQuiz_export')) { $actions['export'] = __('Export', 'wp-adv-quiz'); } if (current_user_can('wpAdvQuiz_edit_quiz')) { $actions['set_category'] = __('Set Category', 'wp-adv-quiz'); } return $actions; } function extra_tablenav($which) { if ($which != 'top') { return; } ?>