// Check project and user rights for view / export
if (!$Proj->longitudinal || $user_rights['data_export_tool'] == "0" && $user_rights['reports'] == "0") {
    $msg = !$Proj->longitudinal ? "Not a longitudinal project" : "You do not have permission to access this page.";
    include APP_PATH_DOCROOT . 'ProjectGeneral/header.php';
    print RCView::div(array('style' => 'max-width:750px;margin-bottom:10px;'), RCView::div(array('style' => 'color: #800000;font-size: 16px;font-weight: bold;float:left;'), "Longitudinal Reports") . RCView::div(array('class' => 'clear'), ''));
    displayMsg($msg, "errorMsg", "center", "red", "exclamation_frame.png", 600);
    include APP_PATH_DOCROOT . 'ProjectGeneral/footer.php';
    exit;
}
// Make sure the user's rights have not expired for the project
if ($user_rights['expiration'] != "" && $user_rights['expiration'] < TODAY) {
    exitWithMessage('Your user account has expired for this project.');
    exit;
}
// Check configuration of report store project
$check = LongitudinalReports::checkReportStoreProjectConfig();
if ($check !== true) {
    exitWithMessage('There is a problem with the configuration of the report store project:<br>' . $check);
    exit;
}
// Place all HTML here
$html = "";
## CREATE NEW REPORT
if (isset($_GET['addedit'])) {
    // Hidden dialog for help with filters and AND/OR logic
    $html .= LongitudinalReports::renderFilterHelpDialog();
    // Hidden dialog for error popup when field name entered is not valid
    $html .= RCView::div(array('id' => 'VarEnteredNoExist_dialog', 'class' => 'simpleDialog'), $lang['report_builder_72']);
    // Add the actual "create report" table's HTML at the very bottom since we're doing a direct print. So output the buffer and disable buffering.
    ob_end_flush();
} elseif (!isset($_GET['report_id'])) {