Ejemplo n.º 1
0
					<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>
Ejemplo n.º 2
0
 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();
 }