public static function renderTabs()
 {
     global $lang, $user_rights, $redcap_version;
     // Get current URL relative to version folder
     /*$version_folder = "redcap_v{$redcap_version}/";
     		$current_url = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], $version_folder) + strlen($version_folder));
     		// Get query string parameters for the current page's URL
     		$params = (strpos($current_url, ".php?") === false) ? array() : explode("&", parse_url($current_url, PHP_URL_QUERY));
     		// Remove query string from $current_url
     		list ($current_url, $query_string) = explode('?', $current_url, 2);
     		// Format query string for the url to add 'pid'
     		if (!empty($params)) {
     			foreach ($params as $key=>$val) {
     				// Remove the pid in the query string
     				if ($val == "pid=".PROJECT_ID) unset($params[$key]);
     			}
     			$current_url .= "?" . implode("&", $params);
     		} */
     // If have report_id, then get report name
     if (isset($_GET['report_id'])) {
         $report_name = self::getReportNames($_GET['report_id']);
     }
     // Determine tabs to display
     $tabs = array();
     // Tab to build a new report
     if ($user_rights['reports']) {
         $tabs[LR_PATH_FROM_WEBROOT . 'index.php?create=1&addedit=1'] = RCView::img(array('src' => 'plus_blue.png', 'style' => 'vertical-align:middle;height:14px;width:14px;')) . RCView::span(array('style' => 'vertical-align:middle;'), $lang['report_builder_14']);
     }
     // Tab to view list of existing reports
     $tabs[LR_PATH_FROM_WEBROOT . 'index.php'] = RCView::img(array('src' => 'layout_down_arrow.gif', 'style' => 'vertical-align:middle;position:relative;top:1px;')) . RCView::span(array('style' => 'vertical-align:middle;'), $lang['report_builder_47']);
     /*		// Other export options (zip, pdf, etc.) if user has some export rights
     		if ($user_rights['data_export_tool'] > 0) {
     			$tabs['DataExport/index.php?other_export_options=1'] = RCView::img(array('src'=>'documents_arrow.png', 'style'=>'vertical-align:middle;')) . 
     										RCView::span(array('style'=>'vertical-align:middle;'), $lang['data_export_tool_188']);
     		}
     */
     // Edit existing report
     if (isset($_GET['addedit']) && isset($_GET['report_id']) && is_numeric($_GET['report_id'])) {
         $tabs[LR_PATH_FROM_WEBROOT . 'index.php?addedit=1&report_id=' . $_GET['report_id']] = RCView::img(array('src' => 'pencil.png', 'style' => 'vertical-align:middle;')) . RCView::span(array('style' => 'vertical-align:middle;'), $lang['report_builder_05'] . $lang['colon'] . RCView::SP . RCView::span(array('style' => 'font-weight:normal;color:#800000;'), $report_name));
     } elseif (!isset($_GET['addedit']) && !isset($_GET['stats_charts']) && isset($_GET['report_id'])) {
         $tabs[LR_PATH_FROM_WEBROOT . 'index.php?report_id=' . $_GET['report_id']] = RCView::img(array('src' => 'layout.png', 'style' => 'vertical-align:middle;')) . RCView::span(array('style' => 'vertical-align:middle;'), $lang['report_builder_44'] . $lang['colon'] . RCView::SP . RCView::span(array('style' => 'font-weight:normal;color:#800000;'), $report_name));
     }
     // Render the tabs
     renderTabs($tabs);
 }
Exemplo n.º 2
0
function showMyProposals($proposals, $current_tab_propid = 0)
{
    $nr = 0;
    $apply_projects = $apply_projects = vals_soc_access_check('dashboard/projects/apply') ? 1 : 0;
    $rate_projects = Users::isSuperVisor();
    $tab_id_prefix = "proposal_page";
    $data = array();
    $activating_tabs = array();
    $current_tab = 1;
    $current_tab_id = "{$tab_id_prefix}{$current_tab}";
    $current_tab_content = '';
    foreach ($proposals as $proposal) {
        $nr++;
        if (!$current_tab_propid && $nr == 1 || $proposal->proposal_id == $current_tab_propid) {
            //$id = $proposal->pid;
            $current_tab = $nr;
            $current_tab_id = "{$tab_id_prefix}{$current_tab}";
            $current_tab_content = renderProposal(Proposal::getInstance()->getProposalById($proposal->proposal_id, TRUE), $current_tab_id, 'myproposal_page');
        }
        $activating_tabs[] = "'{$tab_id_prefix}{$nr}'";
        $data[] = array(0, $proposal->title, 'view', _PROPOSAL_OBJ, $proposal->proposal_id);
    }
    echo renderTabs($nr, 'Proposal', $tab_id_prefix, _PROPOSAL_OBJ, $data, 0, TRUE, $current_tab_content, $current_tab, _PROPOSAL_OBJ);
    ?>
	<script type="text/javascript">
		window.view_settings = {};
		window.view_settings.apply_projects = <?php 
    echo $apply_projects ? 1 : 0;
    ?>
;
		window.view_settings.rate_projects  = <?php 
    echo $rate_projects ? 1 : 0;
    ?>
;
		activatetabs('tab_', [<?php 
    echo implode(', ', $activating_tabs);
    ?>
], '<?php 
    echo $current_tab_id;
    ?>
');
	</script>
<?php 
}
Exemplo n.º 3
0
function showAgreement($agreement = '')
{
    if (!$agreement) {
        $agreement = Agreement::getInstance()->getSingleStudentsAgreement(true);
    }
    $nr = 1;
    $tab_id_prefix = 'agree_page-';
    $data = array();
    $tabs = array("'{$tab_id_prefix}1'");
    //we pass on the buttons=0 since we have the buttons as tabs
    $data[] = array(2, 'Agreement', 'view', _AGREEMENT_OBJ, $agreement->agreement_id, "buttons=0");
    $next_tab = 2;
    //[number of tabs, label start, tab id start, type, data, id, render targets, active target content, active tab]
    echo renderTabs($nr, '', $tab_id_prefix, _AGREEMENT_OBJ, $data, $agreement->agreement_id, TRUE, renderAgreement(_AGREEMENT_OBJ, $agreement, null, "{$tab_id_prefix}1", false), 1, _AGREEMENT_OBJ);
    ?>
	    <script type="text/javascript">
			activatetabs('tab_', [<?php 
    echo implode(',', $tabs);
    ?>
]);
		</script>
	    <?php 
}
Exemplo n.º 4
0
function showOrganisationProjects($org_nr, $projects, $organisation, $show_org_title = TRUE, $show_last = FALSE, $inline = FALSE, $owner_only = FALSE)
{
    $org_id = $organisation->org_id;
    $nr = 1;
    $tab_id_prefix = "project_page{$org_nr}-";
    $data = array();
    $activating_tabs = array();
    $nr_projects = count($projects);
    $current_tab = $show_last && $show_last == $org_id ? $nr_projects + 1 : 1;
    $current_tab_id = "{$tab_id_prefix}{$current_tab}";
    //data is like: [translate, label, action, type, id, extra GET arguments, render with rich text area, render tab to the right]
    $data[] = array(1, 'All', 'list', _PROJECT_OBJ, null, "org={$org_id}&inline=" . ($inline ? 1 : 0) . "&mine=" . ($owner_only ? 1 : 0));
    $activating_tabs[] = "'{$tab_id_prefix}{$nr}'";
    $nr++;
    if ($show_org_title) {
        echo '<h3>' . tt('Projects in your organisation ') . sprintf('<i>%1$s</i>', $organisation->name) . '</h3>';
    }
    foreach ($projects as $project) {
        if ($nr == $current_tab) {
            //$id = $project->pid;
            $my_project = $project;
        }
        $activating_tabs[] = "'{$tab_id_prefix}{$nr}'";
        $data[] = array(0, $project->title, 'view', _PROJECT_OBJ, $project->pid);
        $nr++;
    }
    $data[] = array(1, 'Add', 'add', _PROJECT_OBJ, 0, "target={$tab_id_prefix}{$nr}&org={$org_id}", TRUE, 'right');
    $activating_tabs[] = "'{$tab_id_prefix}{$nr}'";
    //If no target is sent along, the project views are shown inline
    $current_tab_content = 1 == $current_tab ? renderProjects('', $projects, $current_tab_id, $inline, FALSE, FALSE) : renderProject($my_project, $current_tab_id, false);
    echo renderTabs($nr, 'Project', $tab_id_prefix, _PROJECT_OBJ, $data, 0, TRUE, $current_tab_content, $current_tab, _PROJECT_OBJ);
    ?>
	<script type="text/javascript">
		activatetabs('tab_', [<?php 
    echo implode(', ', $activating_tabs);
    ?>
], '<?php 
    echo $current_tab_id;
    ?>
');
	</script>
	<?php 
}
Exemplo n.º 5
0
function showOrganisationMembersPage($organisations)
{
    $tab_offset = 1;
    $data = array();
    $tabs = array();
    // 		[translate, label, action, type, id, extra GET arguments]
    if (user_access('vals admin register')) {
        $data[] = array(1, t('All Members'), 'showmembers', _ORGANISATION_GROUP, 'all');
        $tabs = array("'mentor_page-{$tab_offset}'");
        $tab_offset++;
    }
    foreach ($organisations as $org) {
        $tabs[] = "'mentor_page-{$tab_offset}'";
        $data[] = array(2, $org->name, 'showmembers', _ORGANISATION_GROUP, $org->org_id);
        $tab_offset++;
    }
    if ($data) {
        $first_tab_group_id = $data[0][4];
        echo renderTabs(--$tab_offset, 'Org', 'mentor_page-', _ORGANISATION_GROUP, $data, null, TRUE, renderUsers(_ORGADMIN_TYPE, '', $first_tab_group_id, _ORGANISATION_GROUP, TRUE) . renderUsers(_MENTOR_TYPE, '', $first_tab_group_id, _ORGANISATION_GROUP, TRUE));
        ?>
		<script type="text/javascript">
			activatetabs('tab_', [<?php 
        echo implode(',', $tabs);
        ?>
]);
		</script>
	<?php 
    } else {
        echo t('You cannot see organisation members at the moment');
    }
}