示例#1
0
 /**
  * Loads the content of the tab
  *
  * This function does a few things. First, it loads the subnav, which is visible on every
  * CP BP subtab. Then, it decides which template should be loaded, based on the current
  * view (determined by the URL). It then checks to see whether the template in question
  * has been overridden in the active theme or its parent, using locate_template(). Finally,
  * the proper template is loaded.
  *
  * @package CollabPress
  * @subpackage CP BP
  * @since 1.2
  */
 function display()
 {
     // Render the subnav
     $this->render_subnav();
     // What gets displayed after the subnav depends on the current view
     switch ($this->current_view) {
         case 'project':
             $template = 'collabpress/buddypress/content-single-project.php';
             break;
         case 'task':
             $template = 'collabpress/buddypress/content-single-task.php';
             break;
         case 'list':
         default:
             $template = 'collabpress/buddypress/dashboard.php';
             break;
     }
     cp_load_template($template);
 }
示例#2
0
/**
 * Callback for add_menu_page, calls the proper CollabPress template
 *
 */
function cp_admin_menu_page_load()
{
    global $cp;
    // Find the template depending on the view.
    if (!empty($cp->project)) {
        if ($cp->view == 'task') {
            $template = 'collabpress/content-single-task.php';
        } else {
            if ($cp->view != 'project') {
                if ($cp->view == 'files') {
                    wp_enqueue_media();
                }
                // todo: maybe move this to an enqueue function
                $template = 'collabpress/content-single-project-' . $cp->view . '.php';
            } else {
                $template = 'collabpress/content-single-project.php';
            }
        }
    } else {
        if ($cp->view != 'dashboard') {
            $template = 'collabpress/content-' . $cp->view . '.php';
        } else {
            $template = 'collabpress/dashboard.php';
        }
    }
    cp_load_template($template);
}