/** * @return int * @param Question $q */ public static function updateQuestion($q) { $db = DB::getConn(); $stm = $db->prepare('update Question set title=:title, category=:cate, point=:point, explain=:explain where id=:id'); $stm->bindParam(':title', $q->getTitle()); $stm->bindParam(':cate', $q->getCategory()); $stm->bindParam(':point', $q->getPoint()); $stm->bindParam(':explain', $q->getExplain()); $stm->bindParam(':id', $q->getId()); $stm->execute(); return QuestionCtrl::getLastID(); }
} else { $reminder = 26; $reminderChar = $alphas[$reminder]; $floor = floor($numberColumns / 26); $floor--; } return divideBy26($floor) . $reminderChar; } else { return; } } // set sheets foreach ($survey_questions as $survey_question_id) { $question = new Question(); $question->get_from_db($survey_question_id); $question_title = $question->getTitle(); $question_answers = $question->get_answers(); // Add question title $objPHPExcel->setActiveSheetIndex($sheetId)->mergeCells('A1:N1'); $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue('A1', $question_title); // list answers $columnId = 2; $alphabetIteration = 0; foreach ($question_answers as $question_answer_id) { $answer = new Answer(); $answer->get_from_db($question_answer_id); $cell = divideBy26($columnId) . "2"; $cell_value = $answer->getValue(); // Add some data $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value); $objPHPExcel->getActiveSheet()->getColumnDimension(divideBy26($columnId))->setWidth(15);
</h4> </div> <?php $survey_questions = get_survey_questions($survey->getId()); if (!empty($survey_questions)) { ?> <div class="accordion"> <?php foreach ($survey_questions as $question_id) { $question = new Question(); $question->get_from_db($question_id); if ($question->getType() == 1) { ?> </div> <h3 class="no-float ac"><?php print_r($question->getTitle()); ?> </h3> <div class="al"> <?php $answers = get_survey_answers($question->getId()); foreach ($answers as $answer_id) { $answer = new Answer(); $answer->get_from_db($answer_id); ?> <p>   <?php print_r($answer->getValue()); ?> </p> <?php }
if (!empty($rightCode) && !empty($leftCode)) { if (isset($rowTitlePosition[$leftCode]) && isset($columnTitlePosition[$rightCode])) { $results[$rowTitlePosition[$leftCode]][$columnTitlePosition[$rightCode]] = $trackedAnswer['nbr']; } } } } } //-- DISPLAY (common) //-- display a resume of the selected question // several questions have to be shown on the page if (isset($questionIterator)) { $out .= '<tr class="headerX">' . "\n" . '<th>' . get_lang('Question') . ' ' . $questionIterator . '</th>' . "\n" . '</tr>' . "\n\n" . '<tr>' . '<td>' . "\n"; $questionIterator++; } $out .= '<p><strong>' . $question->getTitle() . '</strong></p>' . "\n" . '<blockquote>' . $displayedStatement . '</blockquote>' . "\n\n" . '<center>'; //-- DISPLAY (by question type) // prepare list to display if ($question->getType() == 'MCUA' || $question->getType() == 'MCMA') { // display tab header $out .= '<table class="claroTable emphaseLine" width="100%" border="0" cellspacing="2">' . "\n" . '<tr class="headerX" align="center" valign="top">' . "\n" . '<th>' . get_lang('Expected choice') . '</th>' . "\n" . '<th width="60%">' . get_lang('Answer') . '</th>' . "\n" . '<th colspan="2">#</th>' . "\n" . '</tr>' . "\n" . '<tbody>' . "\n\n"; // display tab content foreach ($results as $result) { $out .= '<tr>' . "\n" . '<td align="center">'; // expected choice image $out .= '<img src="'; // choose image to display if ($question->getType() != 'MCMA') { if ($result['correct']) { $out .= get_icon_url('radio_on') . '" alt="(X)"'; } else {