Ejemplo n.º 1
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 
}
Ejemplo n.º 2
0
         //$is_modal = ($target !== 'our_content');
         //this is the case where the result is bad and we show an error msg
         //$container =  $is_modal ? 'modal-content' : 'our_content';
         //$before = 'toc' ;
         //$args = array('id' => $proposal_id, 'before'=> $before, 'target'=> $container, 'replace_target'=> true);
         $proposal = Proposal::getInstance()->getProposalById($proposal_id, TRUE);
         if (!$proposal) {
             echo errorDiv(t('This proposal does not seem to exist!'));
             return;
         }
         if (Users::isStudent() && !Groups::isOwner(_PROPOSAL_OBJ, $proposal_id)) {
             echo errorDiv(t('You can only view your own proposals!'));
         } else {
             //TODO: find out whether we use the proposal view only in the my proposals and if not whether this
             //matters: non owners have no right to delete for example and so no reason to do a followup action
             echo renderProposal($proposal, $target, 'myproposal_page');
         }
     } else {
         echo errorDiv(t('No proposal identifier submitted!'));
     }
     break;
 case 'mark_proposal':
     $proposal_id = getRequestVar('proposal_id', 0, 'post');
     $project_id = getRequestVar('project_id', 0, 'post');
     $is_final = getRequestVar('is_final', 0, 'post');
     if (!$project_id) {
         echo t('The project could not be found');
         return;
     }
     if (!$proposal_id) {
         echo t('The proposal could not be found');