function get_answer($id, $was, $admin, $home_url) { $sql_answer = mysql_query("SELECT * FROM `marks` WHERE `answer`='{$id}' ORDER BY `id`"); if (mysql_num_rows($sql_answer) > 0) { $answer = mysql_fetch_array($sql_answer); do { $width = $was * 50 + 50; echo '<div class="comment-content" data-uid="" data-cid="" id="com' . $answer[id] . '" style="margin-left:' . $width . 'px;width:calc(100% - ' . $width . 'px); margin-top:10px;"> <div class="vcorner"></div> <small class="date">' . $answer['date'] . ' ' . lang(44) . ' ' . $answer['time']; if ($admin) { echo ' <a onclick=deletes("marks",' . $answer[id] . ')>Удалить</a>'; } echo '</small> <h6>' . $answer[name] . ' <a onclick=answer("' . $answer[name] . '",' . $answer[id] . ') style="color:#AFAFAF;font-size:85%;margin-left:20px;cursor:pointer">' . lang(45) . '</a>'; if ($admin) { echo ' <a href="' . $home_url . 'camp/' . $answer[camp_id] . '" style="margin-left:20px;">Перейти к лагерю</a>'; } echo '</h6> <div class="p">' . $answer[text] . '</div> <div class="clear"></div> </div>'; if (!get_answer($answer[id], $was + 1, $admin, $home_url)) { exit("Error!"); } } while ($answer = mysql_fetch_array($sql_answer)); return true; } else { return true; } }
function hdu_solve() { for ($i = $hdu_min_id; $i < $hdu_max_id; $i++) { $answers = get_answer($i); foreach ($answers as $answer) { // TODO } } }
function result($exerid, $filename, $code, $output) { if ($exerid == 1) { $answer = get_answer($exerid); if (strcmp($output, $answer) == 0) { return true; } } elseif ($exerid == 2) { $check = check_code_2($code); $answer = get_answer($exerid); $answer = trim($answer); if ($check == 3 && strpos($answer, $output) >= 0) { return true; } } elseif ($exerid == 3 || $exerid == 4 || $exerid == 5 || $exerid == 6) { $cases = get_testcases($exerid); if (run_tests($filename, $cases)) { return true; } } return false; }
<p> <table class="InfoForm" style="width: 95%; margin: 0px auto;"> <?php $odd = FALSE; $quelist = Question(get_question_categoryid('Profile'), '', false, true); $quetype = Question(get_question_categoryid('Profile'), '', true, false); foreach ($quelist as $key => $value) { if ($odd) { $cls = 'class="odd"'; } else { $cls = 'class="even"'; } echo '<tr ' . $cls . '> <td>' . $value . '</td>'; if ($quetype[$key] == 'Text' || $quetype[$key] == 'DOB' || $quetype[$key] == 'TextArea') { echo '<td>' . $plans_list['question_id_' . $key] . '</td>'; } else { echo '<td>' . get_answer($plans_list['question_id_' . $key], $key) . '</td>'; } echo '<tr>'; $odd = !$odd; } ?> </table> </p> </div> </section> <?php } ?> </div>
if (!isset($results[$domain])) { print_r($result); $res = get_answer("Add result for {$domain}"); if ($res) { // Add as it is unset($result['regrinfo']['disclaimer']); $results[$domain] = $result; } } else { // Compare with previous result unset($result['regrinfo']['disclaimer']); unset($results[$domain]['regrinfo']['disclaimer']); $diff = array_diff_assoc_recursive($result, $results[$domain]); if (is_array($diff)) { print_r($diff); $res = get_answer("Accept differences for {$domain}"); if ($res) { // Add as it is $results[$domain] = $result; } } else { echo "Handler for domain {$domain} gives same results as before ...\n"; } } } $fp = fopen('testsuite.txt', 'wt'); fputs($fp, serialize($results)); fclose($fp); //-------------------------------------------------------------------------- function get_answer($question) {
function get_user_info($id, $batch) { $id = (int) $id; $batch = (int) $batch; $user = get_user_by_id($id); $reviews_given = get_number_of_reviews_given($id); $reviews_received = get_number_of_reviews_received($id); $teammember_reviews = get_number_of_poll_team_members($id); $notteammember_reviews = get_number_of_poll_not_team_members($id); $teammanager_reviews = get_number_of_poll_team_manager($id); $notteammanager_reviews = get_number_of_poll_not_team_manager($id); $preferred_reviewers = get_number_of_preferred_reviewers($id); $preferred_reviewees = get_number_of_preferred_reviewees($id); $comments = get_comments($id); $questions = get_questions(); echo get_text('Reviews_received') . ": <b>{$reviews_received}</b><br />" . get_text('Reviews_from_teammember') . ": <b>{$teammember_reviews}</b><br />" . get_text('Reviews_from_not_teammember') . ": <b>{$notteammember_reviews}</b><br />" . get_text('Reviews_from_preferred_reviewer') . ": <b>{$preferred_reviewers}</b><br />"; // get_text('Reviews_given_to_preferred_reviewee') . ": <b>$preferred_reviewees</b><br />"; ?> <h3><?php echo get_Text('Average_score'); ?> </h3> <h4><?php echo get_text('Legend'); ?> </h4> <p> 1: <?php echo get_answer_name(1); ?> <br/> 2: <?php echo get_answer_name(2); ?> <br/> 3: <?php echo get_answer_name(3); ?> <br/> 4: <?php echo get_answer_name(4); ?> <br/> 5: <?php echo get_answer_name(5); ?> </p> <table class="questions"> <?php $number = 1; $categories = get_categories(); foreach ($categories as $category) { ?> <thead> <tr style="margin-top: 25px;"> <th><?php echo $category['Name']; ?> </th> <th><?php echo get_text('Average_score'); ?> </th> <th><?php echo get_text('Your_score'); ?> </th> </tr> </thead> <tbody> <?php foreach ($questions as $question) { if ($category['ID'] == $question['Category']) { ?> <tr id="poll"> <td><?php echo $number . '. ' . $question['Question']; ?> </td> <td style="text-align:center;"><?php $avg_score = get_average_score_user($id, $question['ID']); if ($avg_score == false) { $avg_score = get_answer_name(6); } echo $avg_score; ?> </td> <td style="text-align:center;"> <?php $your_score = get_answer(get_poll_by_reviewer_reviewee_batch($id, $id, $batch), $question['ID']); if ($your_score == 6) { $your_score = get_answer_name(6); } echo $your_score; ?> </td> </tr> <?php $number++; } } ?> <tr class="spacer"></tr> <?php } ?> </tbody> <?php ?> </table> <!--<tr> <th></th> <th><?php echo get_text('Question'); ?> </th> <th><?php echo get_text('Your_score') . '-' . get_text('Average_score'); ?> </th> </tr> <?php foreach ($questions as $key => $question) { ?> <tr> <td> <?php echo $key + 1; ?> </td> <td> <?php echo $question['Question']; ?> </td> <td style="text-align:center;"> <?php echo get_answer_name(get_answer(get_poll_by_reviewer_reviewee_batch($id, $id, $batch), $question['ID'])); echo " - " . get_average_score($id, $question['ID']); ?> </td> </tr> <?php } ?> </table>--> <?php if ($comments) { echo "<h3>" . get_text('Extra_comment') . ":</h3>"; foreach ($comments as $comment) { ?> <div class="comment"><?php echo $comment['Comment']; ?> </div> <?php } } }
<?php } ?> </div> <div class="clear"></div> </h3> <?php $letter++; $bigletter++; } if ($status == 'took') { $his_answer = get_someone_answer($username, $row->id); ?> <div class="right_or_wrong"> <span class="choicec">Your Answer: <?php echo get_answer($his_answer); ?> </span> <br /> <?php if (check_right_answer($his_answer, $row->id) == TRUE) { ?> <span class="choiceb">And it's correct!</span> <?php } else { ?> <span class="choicea">Sorry! It's wrong! The correct answer should be <?php echo get_right_answer($row->id); ?> </span> <?php
session_start(); include "setting.php"; if (!isset($_SESSION['id']) || !isset($_SESSION['ipaddress'])) { gotoindex(); } check_login(); if (!isset($_GET['id']) || !isset($_GET['ans'])) { exit(0); } include "header.php"; $q_id = $_GET['id']; $ans = $_GET['ans']; $m_id = $_SESSION['id']; if (update_answer($m_id, $q_id, $ans) != false) { $answer = get_answer($ans); $q = pg_fetch_assoc($answer, 0); $ans = getAnswer($q['answer']); update_log($m_id, $q['answer']); print "結果は{$ans}です。"; } include "footer.php"; function get_answer($id) { $db = new mydb(); $query = "select * from choices where id = \$1"; $result = $db->query($query, array($id), "getans"); return $result; } function update_answer($m_id, $q_id, $answer) {
$pdf->Ln(5); foreach ($questions as $key => $question) { if ($category['ID'] == $question['Category']) { $pdf->SetFont('Arial', '', 12); $pdf->Cell(10, 3, $key + 1, 0, 0); $pdf->MultiCell(175, 5, $question['Question'], 0, 'L'); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(10); $avg_score = get_average_score_user($id, $question['ID']); if ($avg_score == false) { $avg_score = get_answer_name(6); } $pdf->Cell(5, 10, get_text('Average_score') . ': ' . $avg_score, 0, 0); $pdf->Ln(5); $pdf->Cell(10); $your_score = get_answer(get_poll_by_reviewer_reviewee_batch($id, $id, $batch), $question['ID']); if ($your_score == 6) { $your_score = get_answer_name(6); } $pdf->Cell(5, 10, get_text('Your_score') . ': ' . $your_score, 0, 0); $pdf->Ln(10); if ($pdf->GetY() > 250) { $pdf->AddPage(); } } } } if ($comments) { $pdf->Ln(5); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(175, 10, get_text('Extra') . ' ' . get_text('Comment'), 0, 'C');
<?php } } else { if ($poll_status == get_poll_status_id('Ingestuurd')) { for ($value = 1; $value < 7; $value++) { ?> <td style="text-align:center;"> <input type="radio" name="<?php echo $question['ID']; ?> " value="<?php echo $value; ?> " <?php if ($value == get_answer($poll, $question['ID'])) { echo 'checked'; } ?> disabled/> </td> <?php } } } } ?> </tr> <?php $number++; }
function print_pl_view_data($r) { ?> <div id="tabs-1" class="tabcontent ui-tabs-panel ui-widget-content ui-corner-bottom"> <h4 id="popup_title" class="popup_title" style="text-align: center;">Viewing details of <?php echo $r['full_name']; ?> </h4> <table width="100%" border="0" cellpadding="5" id="invDetail" class="InfoForm"> <tbody> <tr class="even gradeC" style="font-weight:bold;"> <td>RR%</td> <td>Invited</td> <td>Redirected</td> <td>Completed</td> <td>Disqualified</td> <td>Quota Full</td> <td>Earned Points</td> <td>Balance Points</td> </tr> <tr class="odd gradeC"> <td><?php echo getPanelRR($r['panel_list_id']); ?> %</td> <td><?php echo $r['no_invited']; ?> </td> <td><?php echo $r['no_redirected']; ?> </td> <td><?php echo $r['no_completed']; ?> </td> <td><?php echo $r['no_disqualified']; ?> </td> <td><?php echo $r['no_qfull']; ?> </td> <td><?php echo $r['earn_points']; ?> </td> <td><?php echo $r['balance_points']; ?> </td> </tr> </tbody> </table> <br> <h2>General Information</h2> <?php $pl_details = $plans_list = array(); $sql = "SELECT * FROM {{view_panel_list_master}} WHERE panel_list_id = '" . $r['panel_list_id'] . "'"; $pl_details = Yii::app()->db->createCommand($sql)->query()->readAll(); $sql = "SELECT * FROM {{panellist_answer}} WHERE panellist_id = '" . $r['panel_list_id'] . "'"; $pl_answer = Yii::app()->db->createCommand($sql)->query()->readAll(); foreach ($pl_answer as $key => $value) { foreach ($value as $ky => $val) { $plans_list[$ky] = $val; } } ?> <table class="InfoForm" style="width: 100%"> <tr class="even"> <td>Email Address</td> <td><?php echo $pl_details[0]['email']; ?> </td> </tr> <tr class="odd"> <td>Name</td> <td><?php echo $pl_details[0]['full_name']; ?> </td> </tr> <tr class="even"> <td>Status</td> <td> <?php if ($pl_details[0]['status'] == 'E') { echo 'Enabled'; } if ($pl_details[0]['status'] == 'D') { echo 'Disabled'; } if ($pl_details[0]['status'] == 'C') { echo 'Cancelled'; } if ($pl_details[0]['status'] == 'R') { echo 'Registered'; } ?> </td> </tr> <tr class="odd"> <td>Fraud</td> <td> <?php if ($pl_details[0]['is_fraud'] == '0') { echo 'No'; } if ($pl_details[0]['is_fraud'] == '1') { echo 'Yes'; } ?> </td> </tr> <?php $odd = FALSE; $quelist = Question(get_question_categoryid('Registration'), '', false, true); $quetype = Question(get_question_categoryid('Registration'), '', true, false); foreach ($quelist as $key => $value) { if ($odd) { $cls = 'class="odd"'; } else { $cls = 'class="even"'; } echo '<tr ' . $cls . '> <td>' . $value . '</td>'; if ($quetype[$key] == 'Text' || $quetype[$key] == 'DOB' || $quetype[$key] == 'TextArea') { echo '<td>' . $plans_list['question_id_' . $key] . '</td>'; } else { echo '<td>' . get_answer($plans_list['question_id_' . $key], $key) . '</td>'; } echo '<tr>'; $odd = !$odd; } ?> </table> <br> <h2>Professional Information</h2> <table class="InfoForm" style="width: 100%"> <?php $odd = FALSE; $quelist = Question(get_question_categoryid('Profile'), '', false, true); $quetype = Question(get_question_categoryid('Profile'), '', true, false); foreach ($quelist as $key => $value) { if ($odd) { $cls = 'class="odd"'; } else { $cls = 'class="even"'; } echo '<tr ' . $cls . '> <td>' . $value . '</td>'; if ($quetype[$key] == 'Text' || $quetype[$key] == 'DOB' || $quetype[$key] == 'TextArea') { echo '<td>' . $plans_list['question_id_' . $key] . '</td>'; } else { echo '<td>' . get_answer($plans_list['question_id_' . $key], $key) . '</td>'; } echo '<tr>'; $odd = !$odd; } ?> </table> </div> <?php }
function getQuestion($subject, $num) { $result = " "; $host = "localhost"; // host server $user = "******"; // tên truy c?p MySQL $pass = ""; // m?t kh?u truy c?p MySQL $connectserver = mysql_connect($host, $user, $pass); if ($connectserver) { mysql_query('SET character_set_client=utf8'); mysql_query('SET collation_connection=utf8_general_ci'); mysql_select_db("db_e_learning", $connectserver); $sql = "SELECT * FROM `jos_questions` WHERE subjectiD = '" . $subject . "'ORDER BY RAND( ) LIMIT " . $num; $query = mysql_query($sql); if (mysql_num_rows($query) == 0) { echo "<br>Khong tao duoc de"; } else { $i = 1; while ($row = mysql_fetch_array($query)) { ?> <script type="text/javascript"> function ans_<?php echo $row[questionid]; ?> () { alert("Ans for question \"<?php echo $row[question_text]; ?> \" is : \"<?php echo get_answer_correct($row[questionid]); ?> \""); } </script> <?php $all_ans = get_answer($row[questionid]); $tmp = "<br>" . $i++ . "."; $tmp .= $row[question_text] . " <a onclick=\"ans_" . $row[questionid] . "()\" ><u>Hint</u></a>"; $tmp .= "<br><label>"; $tmp .= "<input type=\"radio\" name=\"question_" . $row[questionid] . "\" value=\"A\" id=\"question_" . $row[questionid] . "_A\" />"; $tmp .= "A. " . $all_ans[1]; $tmp .= "</label><br><label>"; $tmp .= "<input type=\"radio\" name=\"question_" . $row[questionid] . "\" value=\"B\" id=\"question_" . $row[questionid] . "_B\" />"; $tmp .= "B. " . $all_ans[2]; $tmp .= "</label><br><label>"; $tmp .= "<input type=\"radio\" name=\"question_" . $row[questionid] . "\" value=\"C\" id=\"question_" . $row[questionid] . "_C\" />"; $tmp .= "C. " . $all_ans[3]; $tmp .= "</label><br><label>"; $tmp .= "<input type=\"radio\" name=\"question_" . $row[questionid] . "\" value=\"D\" id=\"question_" . $row[questionid] . "_D\" />"; $tmp .= "D. " . $all_ans[4]; $tmp .= "</label>"; $tmp .= "<br><input name=\"question_" . $row[questionid] . "\" type=\"hidden\" value=\"" . get_answer_correct($row[questionid]) . "\" />"; $result = $result . "<br>" . $tmp; } $i = 1; } } mysql_close($connectserver); return $result; }
?> <br /> Title: <?php echo get_title($row->quiz_id); ?> <br /> Question: <?php echo $row->question; ?> <br /> Answer ID: <?php echo $row->answer_id; ?> <br /> Answer: <?php echo get_answer($row->answer_id); ?> <br /> Correct: <?php echo $row->correct; ?> <br /> <?php } elseif ($type == 'answer') { ?> ID: <?php echo $row->id; ?> <br /> Question ID: <?php echo $row->question_id;