/** * chấm điểm */ function auto_scoring($topic_manage_id, $number_question) { // lay tat ca topic_id theo topic_manage_id $topics = $this->topic_model->getTopicByTopicManageId($topic_manage_id); foreach ($topics as $topic) { $topic_id = $topic['topic_id']; // lay so cau tra loi dung tat ca hoc sinh co topic_id = 19 $arrays = $this->score_model->scoring($topic_id); if (count($arrays)) { foreach ($arrays as $key => $value) { // tính ra điểm $score = Commonobj::funcScoring(SCORE_MAX, $number_question, $value['number_correct']); $arrays[$key]['score'] = $score; $arrays[$key]['is_mark'] = 1; // Đã chấm điểm } // cập nhật điểm số và số câu trả lời đúng vào db $this->score_model->update_data($arrays); } } redirect(BACKEND_V2_TMPL_PATH . 'topic/lists'); }
private function _writeAnswerOfStudent($section, $answers_student) { $CI =& get_instance(); $CI->load->library('commonobj'); $table = $section->addTable('myOwnTableStyle'); $this->_addResultStudentToRow($table, 'CÂU TRẢ LỜI', true); $maxCol = 5; $n = count($answers_student); $plus = $n < $maxCol ? $n : $maxCol; for ($i = 0; $i < $n; $i += $plus) { $array = array(); for ($j = $i; $j < $i + $plus; $j++) { if ($j < $n) { if (isset($answers_student[$j]->answer)) { $answers = explode(SEPARATE_CORRECT_ANSWER, $answers_student[$j]->answer); foreach ($answers as $key => $value) { $answers[$key] = Commonobj::convertNumberToChar((int) $value); } $answer = implode(SEPARATE_CORRECT_ANSWER, $answers); $array[] = $answers_student[$j]->number_question . '. ' . $answer; } } } $text = implode('<br>', $array); $this->_addResultStudentToRow($table, $text, false, array('spaceAfter' => 100)); } // <br> $section->addTextBreak(); }
<h3 class="panel-title">Câu trả lời</h3> </div> <div class="panel-body"> <table class="table table-answer"> <?php $maxCol = 5; $n = count($answers_student); $plus = $n < $maxCol ? $n : $maxCol; for ($i = 0; $i < $n; $i += $plus) : ?> <tr> <?php for($j = $i; $j < $i + $plus; $j++) : if(isset($answers_student[$j]->answer)) : $answers = explode(SEPARATE_CORRECT_ANSWER, $answers_student[$j]->answer); foreach ($answers as $key => $value) { $answers[$key] = Commonobj::convertNumberToChar((int)$value); } $answer = implode(SEPARATE_CORRECT_ANSWER, $answers); ?> <td><?php if($i < $n) echo $answers_student[$j]->number_question . '. ' . $answer; ?> </td> <?php else:?> <td></td> <?php endif; ?> <?php endfor; ?> </tr> <?php endfor; ?> </table> </div> </div> </div>
src="<?php echo BACKEND_V2_IMAGE_PATH; ?>cross_grey_small.png" title="Close this notification" alt="close" /> </a> <div></div> </div> <fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns --> <div class="ui-widget"> <label>Chọn đề thi</label> <select id="combobox" class="small-input"> <option value="-1">Select one...</option> <?php foreach($topic_manage as $key => $value) : ?> <option value="<?php echo $value['topic_manage_id']; ?>"> <?php echo trim(Commonobj::TrimAll($value['title'])); ?> </option> <?php endforeach; ?> </select> </div> <p> <input type="hidden" name="topic_manage_id" id="topic_manage_id" value="" /> <input class="button" id="submit" type="submit" value="Submit" /> <input class="button" type="button" value="Cancel" onclick="goback();" /> </p> </fieldset>