'', 'name' => __('Name', 'wp-adv-quiz'), 'category' => __('Category', 'wp-adv-quiz'), 'points' => __('Points', 'wp-adv-quiz'), ); return $columns; } function __construct($questionItems, $questionCount, $categoryItems, $perPage) { parent::__construct(array( 'singular' => __('Quiz', 'wp-adv-quiz'), 'plural' => __('Quiz', 'wp-adv-quiz'), 'ajax' => false, 'screen' => get_current_screen()->id )); $this->questionItems = $questionItems; $this->questionCount = $questionCount; $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(); if (current_user_can('wpAdvQuiz_edit_quiz')) { $actions['wpAdvQuiz_edit'] = sprintf('' . __('Edit', 'wp-adv-quiz') . '', $item['quizId'], $item['ID']); } if (current_user_can('wpAdvQuiz_delete_quiz')) { $actions['wpAdvQuiz_delete'] = sprintf('' . __('Delete', 'wp-adv-quiz') . '', $item['quizId'], $item['ID']); } if (current_user_can('wpAdvQuiz_edit_quiz')) { return sprintf('%3$s %4$s', $item['quizId'], $item['ID'], $item['name'], $this->row_actions($actions)); } else { 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; } ?>