<?php echo USER_SURVEY_HOMEPAGE_AVAILABLE_SURVEYS; ?> </h4> </div> <div class="ac"> <div class="accordion"> <?php $surveys_by_user = get_available_by_user_surveys($user->getId()); if (!empty($surveys_by_user)) { foreach ($surveys_by_user as $survey_id) { $survey = new Survey(); $survey->get_from_db($survey_id); ?> <h3 class="no-float ac"><?php print_r($survey->getTitle()); ?> </h3> <div> <div class="ac"> <div class="action no-margin ac"> <form id="formSurvey<?php print_r($survey->getId()); ?> " class="form ac prefix_2" action="./?page=user_survey&funct=survey_funct" method="POST"> <input id="formSurveyView" class="button button-green" name="formSurveyUserView"
?> " style="width: 100%;" /> </div> <?php } ?> <div class="ac info_box box_green"> <h3> <b><?php echo SURVEY_PAGE_SURVEY_TITLE; ?> </b> </h3> <h4> <?php echo $survey->getTitle(); ?> </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>
// increase row number $row_id++; } // create new sheet $objPHPExcel->createSheet(NULL, $sheetId); // Rename worksheet $question_number = $sheetId + 1; $objPHPExcel->getActiveSheet()->setTitle("Question " . $question_number); // increase sheet id $sheetId++; } // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); // Redirect output to a client’s web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="' . $survey->getTitle() . '.xls"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); exit;
function getResponseData() { $survey = new Survey(getSurvey()); $title = $survey->getTitle(); $sub = Language::labelResponseDataSubtitle(); $names = array(Language::labelResponseDataStarted(), Language::labelResponseDataCompleted()); $actiontype = array('begintime', 'endtime'); $returnStr = '<script src="../js/export-csv.js"></script>'; $returnStr .= "<script type='text/javascript'>\n\n\nvar chart = new Highcharts.Chart({\n\n chart: {\n renderTo: 'chart1',\n type: 'spline',\n zoomType: 'x'\n },\n title: {\n text: '" . $title . "'\n },\n subtitle: {\n text: 'Source: " . Language::labelNubis() . "'\n },\n xAxis: {\n type: 'datetime',\n dateTimeLabelFormats: { // don't display the dummy year\n month: '%e. %b',\n year: '%b'\n }\n },\n yAxis: {\n title: {\n text: '# " . Language::labelResponseDataRespondents() . "'\n },\n min: 0\n },\n tooltip: {\n formatter: function() {\n return '<b>'+ this.series.name +'</b><br/>'+\n Highcharts.dateFormat('%e. %b', this.x) +': '+ this.y + '" . Language::labelResponseDataRespondents() . "';\n }\n },\n \n series: ["; foreach ($names as $key => $name) { if ($key != 0) { $returnStr .= ','; } $returnStr .= "{\n name: '" . $name . "',\n data: ["; $returnStr .= $this->getFieldNotNull(getSurvey(), $actiontype[$key]); $returnStr .= " ]\n }"; } $returnStr .= "\n ]\n });\n //}); \n\n\n</script>"; return $returnStr; }
/** * @param Survey $s */ public static function update($s) { $db = DB::getConn(); $t = $s->getTitle(); $sh = $s->getShow(); $id = $s->getId(); $stm = $db->prepare('update Survey set title=:title, show=:show where id=:id'); $stm->bindParam(':title', $t); $stm->bindParam(':show', $sh); $stm->bindParam(':id', $id); $stm->execute(); // return DB::getLastID('Survey'); }