<h2><?php echo MvcInflector::pluralize_titleize($model->name); ?> </h2> <form id="posts-filter" action="<?php echo MvcRouter::admin_url(); ?> " method="get"> <p class="search-box"> <label class="screen-reader-text" for="post-search-input">Search:</label> <input type="hidden" name="page" value="<?php echo MvcRouter::admin_page_param($model->name); ?> " /> <input type="text" name="q" value="<?php echo empty($params['q']) ? '' : $params['q']; ?> " /> <input type="submit" value="Search" class="button" /> </p> </form> <div class="tablenav"> <div class="tablenav-pages"> <?php echo paginate_links($pagination);
public function add_menu_pages() { global $_registered_pages; $menu_position = 12; $menu_position = apply_filters('mvc_menu_position', $menu_position); foreach ($this->model_names as $model_name) { $model = MvcModelRegistry::get_model($model_name); if (!$model->hide_menu) { $tableized = MvcInflector::tableize($model_name); $pluralized = MvcInflector::pluralize($model_name); $titleized = MvcInflector::titleize($model_name); $pluralize_titleized = MvcInflector::pluralize_titleize($model_name); $controller_name = 'admin_' . $tableized; $top_level_handle = 'mvc_' . $tableized; $admin_pages = $model->admin_pages; $method = $controller_name . '_index'; $this->dispatcher->{$method} = create_function('', 'MvcDispatcher::dispatch(array("controller" => "' . $controller_name . '", "action" => "index"));'); add_menu_page($pluralize_titleized, $pluralize_titleized, 'administrator', $top_level_handle, array($this->dispatcher, $method), null, $menu_position); foreach ($admin_pages as $key => $admin_page) { $method = $controller_name . '_' . $admin_page['action']; if (!method_exists($this->dispatcher, $method)) { $this->dispatcher->{$method} = create_function('', 'MvcDispatcher::dispatch(array("controller" => "' . $controller_name . '", "action" => "' . $admin_page['action'] . '"));'); } $page_handle = $top_level_handle . '-' . $key; if ($admin_page['in_menu']) { add_submenu_page($top_level_handle, $admin_page['label'] . ' ‹ ' . $pluralize_titleized, $admin_page['label'], $admin_page['capability'], $page_handle, array($this->dispatcher, $method)); } else { // It looks like there isn't a more native way of creating an admin page without // having it show up in the menu, but if there is, it should be implemented here. // To do: set up capability handling and page title handling for these pages that aren't in the menu $hookname = get_plugin_page_hookname($page_handle, ''); if (!empty($hookname)) { add_action($hookname, array($this->dispatcher, $method)); } $_registered_pages[$hookname] = true; } } $menu_position++; } } }