<?php if ($answer->getType() == "radio") { print 'name="formSurvey' . $question->getId() . 'Answer" '; } else { print 'name="formSurvey' . $question->getId() . 'Answer' . $answer->getId() . 'Type' . $answer->getType() . '" '; } ?> type="<?php print $answer->getType(); ?> " value="<?php if ($answer->getType() == "radio" || $answer->getType() == "checkbox") { print_r($answer_id); } elseif ($answer->getType() == "text" && $has_answered == TRUE) { print_r($vote->getValue()); } ?> " <?php if ($has_answered == TRUE) { if (($answer->getType() == "radio" || $answer->getType() == "checkbox") && !empty($user_vote_by_answer)) { ?> checked="checked" <?php } ?> disabled="disabled" <?php } ?>
$objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value); // list votes by user $columnId = 2; foreach ($question_answers as $question_answer_id) { $vote = new Vote(); $vote_id_array = $vote->get_by_user_and_answer($voted_user_id, $question_answer_id); $cell_value = ""; $answer = new Answer(); $answer->get_from_db($question_answer_id); if (!empty($vote_id_array)) { $vote_id = $vote_id_array[0]; $vote->get_from_db($vote_id); if ($answer->getType() == "radio" || $answer->getType() == "checkbox") { $cell_value = 1; } elseif ($answer->getType() == "text") { $cell_value = $vote->getValue(); } } // fill in cell $cell = divideBy26($columnId) . $row_id; // Add some data $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value); $objPHPExcel->getActiveSheet()->getStyle($cell)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); // increase column number $columnId++; } // increase row number $row_id++; } // create new sheet $objPHPExcel->createSheet(NULL, $sheetId);