project_id = $project_id; $project = get_post( $project_id ); $this->project_name = $project->post_title; add_action( 'admin_init', array ( $this, 'init' ) ); add_action( 'admin_menu', array( $this, 'dashboard_hooks' ) ); } function init() { foreach ( array('projects', 'parts', 'library_items', 'imported_items') as $type ) { add_meta_box('anthologize', 'Anthologize', array($this,'item_meta_box'), $type, 'side', 'high'); } add_action('save_post',array( $this, 'item_meta_save' )); do_action( 'anthologize_admin_init' ); } function dashboard_hooks() { global $menu; $menu[57] = array( 1 => read, 2 => 'separator-anthologize', 4 => 'wp-menu-separator' ); $plugin_pages = array(); // Adds the top-level Anthologize Dashboard menu button $this->add_admin_menu_page( array( 'menu_title' => __( 'Anthologize', 'anthologize' ), 'page_title' => __( 'Anthologize', 'anthologize' ), 'access_level' => 10, 'file' => 'anthologize', 'function' => array( $this, 'display'), 'position' => 56 ) ); // Creates the submenu items $plugin_pages[] = add_submenu_page( 'anthologize', __('My Projects','anthologize'), __('My Projects','anthologize'), 'manage_options', 'anthologize', array ( $this, 'display' ) ); $plugin_pages[] = add_submenu_page( 'anthologize', __('New Project','anthologize'), __('New Project','anthologize'), 'manage_options', dirname( __FILE__ ) . '/class-new-project.php'); $plugin_pages[] = add_submenu_page( 'anthologize', __( 'Export Project', 'anthologize' ), __( 'Export Project', 'anthologize' ), 'manage_options', dirname( __FILE__ ) . '/class-export-panel.php' ); $plugin_pages[] = add_submenu_page( 'anthologize', __( 'Import Content', 'anthologize' ), __( 'Import Content', 'anthologize' ), 'manage_options', dirname( __FILE__ ) . '/class-import-feeds.php' ); foreach ( $plugin_pages as $plugin_page ) { add_action( "admin_print_styles", array( $this, 'load_styles' ) ); add_action( "admin_print_scripts-$plugin_page", array( $this, 'load_scripts' ) ); } } // Borrowed, with much love, from BuddyPress. Allows us to put Anthologize way up top. function add_admin_menu_page( $args = '' ) { global $menu, $admin_page_hooks, $_registered_pages; $defaults = array( 'page_title' => '', 'menu_title' => '', 'access_level' => 2, 'file' => false, 'function' => false, 'icon_url' => false, 'position' => 100 ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); $file = plugin_basename( $file ); $admin_page_hooks[$file] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $file, '' ); if (!empty ( $function ) && !empty ( $hookname )) add_action( $hookname, $function ); if ( empty($icon_url) ) $icon_url = 'images/generic.png'; elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) $icon_url = 'https://' . substr($icon_url, 7); do { $position++; } while ( !empty( $menu[$position] ) ); $menu[$position] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); unset( $menu[$position][5] ); $_registered_pages[$hookname] = true; return $hookname; } function load_scripts() { wp_enqueue_script( 'anthologize-js', WP_PLUGIN_URL . '/anthologize/js/project-organizer.js' ); wp_enqueue_script( 'jquery'); wp_enqueue_script( 'jquery-ui-core'); wp_enqueue_script( 'jquery-ui-sortable'); wp_enqueue_script( 'jquery-ui-draggable'); wp_enqueue_script( 'blockUI-js', WP_PLUGIN_URL . '/anthologize/js/jquery.blockUI.js' ); wp_enqueue_script( 'anthologize_admin-js', WP_PLUGIN_URL . '/anthologize/js/anthologize_admin.js' ); wp_enqueue_script( 'anthologize-sortlist-js', WP_PLUGIN_URL . '/anthologize/js/anthologize-sortlist.js' ); } function load_styles() { wp_enqueue_style( 'anthologize-css', WP_PLUGIN_URL . '/anthologize/css/project-organizer.css' ); } function load_project_organizer( $project_id ) { require_once( dirname( __FILE__ ) . '/class-project-organizer.php' ); $project_organizer = new Anthologize_Project_Organizer( $project_id ); $project_organizer->display(); } function display_no_project_id_message() { ?>

|
' . __('Edit Project') . ''; $controlActions[] = ''.__('Manage Parts') . ''; $controlActions[] = ''.__('Delete Project') . ''; ?> |
get_project_parts(); echo count($parts); ?> | get_project_items(); echo count($items); ?> |
|---|