示例#1
0
        }
        $inval = $indata->{$opfieldid};
        switch ($opfieldtype) {
            case 'text':
                if (!is_string($inval)) {
                    finishWith('invalid: ' . $opfieldid);
                }
                break;
            case 'list':
                if (!is_array($inval)) {
                    finishWith('invalid: ' . $opfieldid);
                }
                foreach ($inval as $val) {
                    if (!is_string($val)) {
                        finishWith('invalid val in ' . $opfieldid);
                    }
                }
                break;
        }
        $indata_processed->{$opfieldid} = $inval;
    }
    $op_part_data = json_encode($indata_processed);
}
$return = joinOperation($op['id'], $user['id'], $op_part_data);
$status = $return['status'];
if ($status !== TRUE) {
    finishWith($status);
}
attachParticipantToOperation($op, $user['id']);
$opHtml = renderOpWithTasks($op);
echo json_encode(array('status' => 'success', 'ophtml' => $opHtml, 'addedpoints' => $return['addedpoints']));
示例#2
0
<?php 
$ops = getParticipatingOperationsAndTasks($user['id']);
if (count($ops) > 0) {
    echo <<<OPS_INTRO
                    <div class="description">
                        <p>Operations you're participating.</p>
                        <ul>
                            <li>Click a task in an operation to complete it.</li>
                            <li>Completing a task before its deadline gets you get 20 points!</li>
                            <li>Completing a task after its deadline gets you only 10 points.</li>
                            
                        </ul>
                    </div>
OPS_INTRO;
    foreach ($ops as $op) {
        $op_html = renderOpWithTasks($op);
        echo $op_html;
    }
} else {
    echo <<<NO_OPS_MSG
                    <div class="card">
                        <p>You have not joined any operations. Go ahead and join one!</p>
                    </div>
NO_OPS_MSG;
}
?>
                    
                                            
                </section><!--//section-->
            </div>