コード例 #1
0
ファイル: proposals.php プロジェクト: edwinraycom/vals-soc
function renderProposal($proposal, $target = 'none', $follow_action = 'show')
{
    //A proposal consists of: fields = array('proposal_id', 'owner_id', 'org_id', 'inst_id',
    //'supervisor_id', 'pid', 'solution_short', 'solution_long', 'state',);
    $propid = $proposal->proposal_id;
    $buttons = '';
    if (Users::isStudent() && Groups::isOwner(_PROPOSAL_OBJ, $propid) && $proposal->state != 'published') {
        $delete_action = "onclick='if(confirm(\"" . t('Are you sure you want to delete this proposal?') . "\")){ajaxCall(\"proposal\", \"delete\", " . "{type: \"proposal\", proposal_id: {$propid}, target: \"{$target}\"}, \"refreshTabs\", \"json\", " . "[\"proposal\", \"{$target}\", \"proposal\", \"\", \"{$follow_action}\"]);}'";
        $edit_action = "onclick='ajaxCall(\"proposal\", \"edit\", {type: \"proposal\", proposal_id: {$propid}, target: " . "\"{$target}\", format:\"html\"}, \"formResult\", \"html\", [\"{$target}\", \"proposal\"]);'";
        $buttons .= "<div class='totheright' id='proposal_buttons'><input type='button' value='" . t('edit') . "' {$edit_action}/>";
        $buttons .= "<input type='button' value='" . t('delete') . "' {$delete_action}/></div>";
    }
    $content = "<div id='msg_{$target}'></div>\r\n\t{$buttons}" . "<h1>" . ($proposal->title ? $proposal->title : Proposal::getDefaultName('', $proposal)) . " (" . renderDefaultField('state', $proposal) . ")</h1>\r\n\r\n\t<div id='personalia'>\r\n\t<h3>Parties involved</h3>\r\n\t\t<ul>\r\n\t\t\t<li>" . t('Supervisor') . ": " . renderDefaultField('supervisor_name', $proposal, 'supervisor_user_name') . "</i>" . "<li>" . t('Mentor') . ": " . renderDefaultField('mentor_name', $proposal, 'mentor_user_name') . "</i>" . "<li>" . t('Student') . ": " . renderDefaultField('student_name', $proposal, 'name') . "</i>" . "<li>" . t('Institute') . ": " . renderDefaultField('i_name', $proposal) . "</i>" . "<li>" . t('Organisation') . ": " . renderDefaultField('o_name', $proposal) . "</i>" . "</ul>\r\n\t</div>" . "<div id='project'>\r\n\t\t" . t('Project') . ": " . $proposal->pr_title . "\r\n\t</div>" . "<div id='proposal_text'>\r\n\t\t<h3>" . t('Solution Summary') . "</h3>\r\n\t\t" . renderDefaultField('solution_short', $proposal) . "<br/>" . "<a href='javascript:void(0)' data='off' onclick='makeVisible(\"solution_{$propid}\");'>" . t('more') . "</a>" . "\r\n\t\t\t<div id='solution_{$propid}' class='invisible'>\r\n\t\t\t<h3>Solution</h3>\r\n\t\t\t" . renderDefaultField('solution_long', $proposal) . "\r\n\t\t\t</div>\r\n\t</div>";
    module_load_include('inc', 'vals_soc', 'includes/ui/comments/threaded_comments');
    $content .= initComments($propid, _PROPOSAL_OBJ);
    return $content;
}