Skip to content

Commit

Permalink
Dev issue #11885: Review "print survey"
Browse files Browse the repository at this point in the history
Dev: This we must use qanda-helper for all question here (select/option must be reset to list)
Dev: or Question Object must return a printview when we have one
  • Loading branch information
Shnoulle committed Nov 12, 2016
1 parent 3de1ed7 commit e22b981
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 414 deletions.
419 changes: 256 additions & 163 deletions application/controllers/admin/printablesurvey.php

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions application/helpers/common_helper.php
Expand Up @@ -843,13 +843,13 @@ function alternation($alternate = '' , $type = 'col')
*/
if($type == 'row')// Row is sub question OR Y Axis subquestion : it must be column for array by column
{
$odd = 'ls-odd'; // should be row_odd
$even = 'ls-even'; // should be row_even
$odd = 'ls-odd';
$even = 'ls-even';
}
else // cols is answers part OR X axis subquestion : it must the row in array by column
{
$odd = 'ls-col-odd'; // should be col_odd
$even = 'ls-col-even'; // should be col_even
$odd = 'ls-col-odd';
$even = 'ls-col-even';
};
if($alternate == $odd)
{
Expand Down Expand Up @@ -2529,6 +2529,7 @@ function buildLabelSetCheckSumArray()

/**
* Returns a flat array with all question attributes for the question only (and the qid we gave it)!
* @depecated : use QuestionAttribute::model()->getQuestionAttributes($iQID); directly
* @param $iQID The question ID
* @return array$bOrderByNative=>value, attribute=>value} or false if the question ID does not exist (anymore)
*/
Expand Down
26 changes: 26 additions & 0 deletions styles-public/printable.css
@@ -0,0 +1,26 @@
/*!
* Style for print template.css
*
* Copyright 2016 LimeSurvey <http://www.limesurvey.org>
* @license This file is part of LimeSurvey under GNU/GPL License v3 or later, see LICENSE.php
*
*/

.input-radio{
display:inline-block;
width:1.4em;
height:1.4em;
border:1px solid #000;
border-radius:0.7em;
margin:0.1em;
}
.input-checkbox{
display:inline-block;
width:1.4em;
height:1.4em;
border:1px solid #000;
margin:0 0.1em;
}
.form-control.input-textarea,.form-control.input-text,.form-control.input-rank{border:1px solid #000;margin:0.1em;}
.table{width:100%;table-layout:fixed}
.form-control{max-width:100%}
5 changes: 4 additions & 1 deletion templates/default/config.xml
Expand Up @@ -37,6 +37,7 @@
<filename>scripts/template.js</filename>
</js>
<print_css>
<filename>css/bootstrap.css</filename>
<filename>css/print_template.css</filename>
</print_css>

Expand All @@ -62,7 +63,9 @@
<filename>scripts/template.js</filename>
</js>
<print_css>
<filename>css/print_template-rtl.css</filename>
<filename>css/bootstrap.css</filename>
<filename>css/bootstrap-rtl.css</filename>
<filename>css/print_template.css</filename>
</print_css>
</rtl>

Expand Down
227 changes: 5 additions & 222 deletions templates/default/css/print_template.css
@@ -1,239 +1,22 @@
body {
font-family: arial, helvetica, sans-serif;
font-size: 12px;
font-size: 12pt;
}

h1,h2,h3,h4 {
font-family: verdana, arial, helvetica, sans-serif;
}

h2 {
margin-top: 2em;
}

h3 {
margin-top: 0%;
}

* {
page-break-after: auto;
}

p.q-type-help {
margin-bottom: 0.5em;
}

div.q-help {
margin-top: 1.5em;
margin-bottom: 0%;
}

div.q-answer {
font-size: 110%;
}

div.q-answer ul {
margin-left: 0%;
padding-left: 0.2em;
}

div.q-answer ul li {
list-style-type: none;
line-height: 1.9em;
margin-left: 0%;
padding-left: 0%;
}

div.survey-group {
page-break-after: always;
}

div.boilerplate,div.choice-5-pt-radio,div.date,div.list-radio-flexible,div.list-radio,div.list-dropdown-flexible,div.list-dropdown,div.list-with-comment,div.ranking,div.multiple-opt,div.language,div.multiple-opt-comments,div.multiple-short-txt,div.numeric-multi,div.numeric,div.text-short,div.text-long,div.text-huge,div.yes-no,div.gender,div.array-5-pt,div.array-10-pt,div.array-yes-uncertain-no,div.array-increase-same-decrease,div.array-flexible-row,div.array-flexible-column,div.array-multi-flexi,div.array-multi-flexi-text,div.array-flexible-duel-scale
{
.question-wrapper {
border: 0.1em solid #aaa;
padding: 1em;
margin: 1em 0.5em;
clear: both;
page-break-inside: avoid;
page-break-before: auto;
}

.breakbefore {
page-break-before: always !important;
}

.other {

}

.question ul,.question ul li {
margin-left: 0%;
padding-left: 0%;
list-style: none;
}

.question ul li {
margin-bottom: 0.5em;
}

img.input-radio,img.input-checkbox {
position: relative;
top: 1px;
margin-right: 0.5em;
}

div.input-other,div.input-othercomment,div.input-rank,div.input-text,div.input-textarea
{
border: 0.1em solid #666666;
}

li.other {
margin-top: 0.3em;
}

div.input-other,div.input-othercomment {
width: 20em;
height: 2em;
display: inline-block;
}

.multiple-opt div.input-other {
padding-left: 5.5em;
}

.multiple-opt-comments div.other-replacettext {
display: table-cell;
}

.multiple-opt-comments div.input-other {
width: 10em;
display: inline-block;
margin-left: 5px;
}

.multiple-opt-comments div.input-othercomment {
width: 24em;
display: table-cell;
}

div.other-replacetext {
white-space: nowrap;
}

.ranking .q-answer li {
padding-left: 4em;
line-height: 2em;
}

.ranking li div.input-rank {
margin: 0% 0% -1.8em -4em;
width: 3em;
height: 2em;
}

.multiple-opt-comments .q-answer li,.multiple-short-txt .q-answer li,.numeric-multi .q-answer li
{
line-height: 2em;
}

.multiple-opt-comments div.input-text,.multiple-short-txt div.input-text,.numeric-multi div.input-text
{
display: table-cell;
}

.multiple-opt-comments .q-answer ul li span,.multiple-short-txt .q-answer ul li span,.numeric-multi .q-answer ul li span
{
display: table-cell;
padding-right: 5px;
}

.multiple-opt-comments .q-answer ul li,.multiple-short-txt .q-answer ul li,.numeric-multi .q-answer ul li
{
display: table-row;
}

.multiple-opt-comments .q-answer ul,.multiple-short-txt .q-answer ul,.numeric-multi .q-answer ul
{
display: table;
border-spacing: 3px;
}

#limesurvey .q-answer table thead th,#limesurvey .q-answer table .repeat th
{
text-align: center;
vertical-align: bottom;
font-weight: normal;
padding: 0% 1em;
}

#limesurvey .q-answer table tbody td {
text-align: center;
}

#limesurvey .q-answer table tbody td img {
margin: 0%;
}

#limesurvey .q-answer table tbody th.answertext,#limesurvey .q-answer table tbody th.arraycaptionleft
{
text-align: left;
font-weight: normal;
}

/*
div.array-5-pt .q-answer table thead th
,div.array-10-pt table thead th
,div.array-yes-uncertain-no .q-answer table thead th
,div.array-increase-same-decrease .q-answer table thead th
,div.array-flexible-row .q-answer table thead th
,div.array-flexible-column .q-answer table thead th
,div.array-multi-flexi .q-answer table thead th
,div.array-multi-flexi-text .q-answer table thead th
,div.array-flexible-duel-scale .q-answer table thead th
*/
div.array-multi-flexi .q-answer table tbody td div.input-text {
margin-left: auto;
margin-right: auto;
}

.array-flexible-column tbody th.arraycaptionleft {
padding-right: 1em;
}

#limesurvey .q-answer table tbody th.answertextright {
text-align: left;
font-weight: normal;
}

/*
.array-increase-same-decrease {}
.array-flexible-row {}
.array-flexible-column {}
.slider {}
.array-multi-flexi {}
.array-flexible-duel-scale {}
*/
.array-flexible-column col.odd,.array-flexible-column th.odd {
}


/*fix styling for some questions that cannot be controlled individually */
div.input-rank {
width: 51px !important;
}

.array-multi-flexi-text div.input-text {
width: 155px !important;
}

.date div.input-text {
width: 207px !important;
}

.multiple-opt-comments div.input-text {
width: 389px !important;
}

div.input-other {
width: 155px !important;
}
.question-wrapper .h3{margin-top:0}
.table-print-answers thead th{text-align:center;vertical-align:bottom}
.table-print-answers tbody td{text-align:center;vertical-align:middle}
5 changes: 1 addition & 4 deletions templates/default/views/print_group.pstpl
@@ -1,11 +1,8 @@
<div class="survey-group{ODD_EVEN}">
<h2>{GROUPNAME}</h2>

<div class="group-desc">
{GROUPDESCRIPTION}
</div>

{QUESTIONS}

</div>
</div>

17 changes: 9 additions & 8 deletions templates/default/views/print_question.pstpl
@@ -1,18 +1,19 @@

<div id="question{QUESTION_ID}" class="{QUESTION_CLASS}">
<div id="question{QUESTION_ID}" class="question-wrapper {QUESTION_CLASS}">
<div class="q-text">
<h3>{QUESTION_NUMBER} [{QUESTION_CODE}]{QUESTION_TEXT} <span class="mandatory">{QUESTION_MANDATORY}</span></h3>
<p class="q-scenaria">{QUESTION_SCENARIO}</p>
<p class="q-type-help">{QUESTION_TYPE_HELP}</p>
<p class="q-man-message">{QUESTION_MAN_MESSAGE}</p>
<p class="q-validation">{QUESTION_VALID_MESSAGE}</p>
<p class="q-fvalidation">{QUESTION_FILE_VALID_MESSAGE}</p>
<div class="label label-default pull-left">{QUESTION_NUMBER}</div> <div class="label label-primary pull-left">{QUESTION_CODE}</div>
<div class="h3"><div class="mandatory pull-left">{QUESTION_MANDATORY}</div> {QUESTION_TEXT} </div>
<div class="q-scenaria">{QUESTION_SCENARIO}</div>
<div class="q-type-help">{QUESTION_TYPE_HELP}</div>
<div class="q-man-message">{QUESTION_MAN_MESSAGE}</div>
<div class="q-validation">{QUESTION_VALID_MESSAGE}</div>
<div class="q-fvalidation">{QUESTION_FILE_VALID_MESSAGE}</div>
</div>
<div class="q-answer">
{ANSWER}
</div>
<div class="q-help">
{QUESTIONHELP}
</div>
</div>
</div>

0 comments on commit e22b981

Please sign in to comment.