From: angek p. <ang...@ip...> - 2002-03-17 11:20:47
|
All, There are a few other files that need to be changed that I have not mentioned. The changes mentioned below (in my original post) suppress a question number from appearing next to the Statement, however this means that the next valid question will appear to not have a consecutive Question number appearing next to it. for example, assume our survey has 5 questions which includes the Statement. If our Statement is question 3 then our survey will show the following: (1) Question text (2) Question text Statement (4) Question text (5) Question text To correct this the code should be: <?php if ($tid != '11') echo ("<A NAME=\"Q($i)\">($i).</A>"); else $i--; ?> Once this is done you will notice that viewing survey results, and viewing a survey report will not be consistent with the above ammendment so the following further changes need to be made to provide consistency through the entire phpesp package. The following files must be changed: 1- /lib/esphtml.results.inc 2- /function/survey_results.inc 3- /function/survey_report.inc 4- /function/survey_merge.inc Changes to esphtml.results.inc line 188 : function mkreslist($counts,$total,$precision,$showTotals) { should be changed to : function mkreslist($counts,$total,$precision,$showTotals,$tid) { after line 191: <table width="90%" border="0" cellpadding="1"> add the following: <?php if ($tid != '11') echo "<tr><th align=\"left\">#</th><th>Response</th></tr>"; ?> then delete / comment out the line: <tr><th align="left"><?php echo(_('#')); ?></th><th><?php echo(_('Response')); ?></th></tr> Changes to survey_results.inc on about line 167 you should find the following 2 lines: <tr xbgcolor="<?php echo($bg); ?>"> <td> add the following straight after the above lines: <?php if ($tid != '11') echo ("<A NAME=\"Q($i)\">($i).</A>"); else $i--; ?> then delete / comment out the line: <A NAME="Q<?php echo($i); ?>"><?php echo($i); ?>.</A> on about line 324: mkreslist($counts,$total,$precision,$showTotals); change this to : mkreslist($counts,$total,$precision,$showTotals,$tid); Changes to survey_report.inc on about line 85: <tr bgcolor="<?php echo($bg); ?>"> add the following straight after this line: <?php if ($tid != '11'){ echo "<td align=\"right\">$i</td>"; } else{ $i--; echo "<td align=\"right\"></td>"; } ?> then delete / comment out the following line: <td align="right"><?php echo($i); ?></td> Finally, just to be consistent with the changes made to the mkreslist function in both esphtml.results.inc and survey_results.inc we need to make the same change to the survey_merge file. line 350:mkreslist($counts,$total,$precision,$showTotals); needs to be changed to: mkreslist($counts,$total,$precision,$showTotals, $tid); This should be all. If you have any problems with these changes post them here....... Kon -----Original Message----- From: Kon Angelopoulos [mailto:ang...@ip...] Sent: Sunday, 17 March 2002 7:40 PM To: an...@cp... Subject: FW: Adding Descriptive text in a survey. -----Original Message----- From: Kon Angelopoulos [ <mailto:ang...@ip...> mailto:ang...@ip...] Sent: Sunday, 17 March 2002 7:10 PM To: 'php...@li...' Subject: Adding Descriptive text in a survey. Hi All, One of the features I needed phpesp to have was the ability of adding descriptive text in a survey without having it be a question. I've also noticed that this has also appeared in the feature requests so I decided to do this myself. Here are the steps. 1. log into the phpesp database and issue the following sql statement: " insert into question_type values(11,'Statement','N','response_text'); " 2. now edit the /admin/include/function/survey_render.inc file. A:/ go to line 85. the original line (version 1.5) is: <?php if($question['required']=='Y') { echo('<font color="#FF0000">*</font>'); } ?><A NAME="Q<?php echo($i); ?>"><?php echo($i); ?>.</A> change this line to: <?php if($question['required']=='Y') { echo('<font color="#FF0000">*</font>'); } ?> and then add the following line 4 lines: <?php if ($tid != '11') echo ("<A NAME=\"Q($i)\">($i).</A>"); ?> This ensures that the Statement does not have a Question number displayed next to it. B:/ The next step is to find the following line: <td valign="TOP" aligh="LEFT"> - this should be line 87 in the original file or line 91 if you've added the above code. change it to: <td valign="TOP" aligh="LEFT" width="95%"> This will prevent large descriptive text or statements from messing up the formatting of your survey. and that is all.. Simply create or edit a survey, go to the Question tab where you will notice the new item "Statement" in the New Field's type dropdown list and enter your statement in the Text's text field. There can not be any possible answers to this statement so you do not need to fill in the rest of the fields in the Question tab page. Enjoy ! Regards Kon Angelopoulos |