Exemplo n.º 1
0
     if (isset($_GET['mine_only']) && $_GET['mine_only']) {
         $owner_id = Users::getMyId();
     }
     //Return result to jTable
     $recs = Project::getInstance()->getProjectsAndProposalCountByCriteria($organisation, $owner_id, $_GET["jtSorting"], $_GET["jtStartIndex"], $_GET["jtPageSize"]);
     $cnt = Project::getInstance()->getProjectsAndProposalCountByCriteriaRowCount($organisation, $owner_id);
     jsonGoodResultJT($recs, $cnt);
     break;
 case 'list':
     try {
         $target = getRequestVar('target', null);
         $inline = getRequestVar('inline', false);
         $org_id = getRequestVar('org', null);
         $mine = getRequestVar('mine', false);
         $organisations = $org_id ? array($org_id) : null;
         echo renderProjects($organisations, '', $target, $inline, true, $mine);
     } catch (Exception $ex) {
         //Return error message
         errorDiv($ex->getMessage());
     }
     break;
 case 'project_detail':
     $project_id = getRequestVar('project_id', null);
     $project = null;
     if ($project_id) {
         try {
             if (isset($_SESSION['lists']['projects']) && $_SESSION['lists']['projects']) {
                 $current = getRequestVar('current', -1);
                 if ($current >= 0) {
                     $project = $_SESSION['lists']['projects']['list'][$current];
                 } else {
Exemplo n.º 2
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 
}