2 $monLibrary= dirname(__FILE__) .
"/../library";
3 require_once(
"$monLibrary/cu_top.i");
4 require_once(
"$monLibrary/ck_hticket.i");
6 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
9 header(
"Location: /hcuadm/hcu_noperm.prg");
13 $dms_ok=array(
'survey'=>
'string',
'action'=>
'string',
'delrow'=>
'digits',
'msg'=>
'string',
'showrows'=>
'digits',
'AddChange'=>
'string',
'chgrun'=>
'string',
'qstyle'=>
'string',
'qtext'=>
'string',
'rstat'=>
'digits',
'sname'=>
'string',
'sstart'=>
'string',
'sstop'=>
'string',
'todelete'=>
'string',
'xa'=>
'array');
16 $survey = (empty($survey) ?
"" : trim($survey));
17 $self = $_SERVER[
'PHP_SELF'] ;
18 $main_url =
"https://" . $_SERVER[
'HTTP_HOST'] . $_SERVER[
'SCRIPT_NAME'];
20 $pg_ttl =
"CU Admin Survey Maintenance";
22 $action = (empty($action) ?
"OK" : $action);
23 $action = trim(strtolower($action));
25 $msg = (empty($msg) ?
"NO MESSAGE" : $msg);
27 $today = date(
"m/d/Y");
28 $twoweeks = date(
"m/d/Y",mktime (0,0,0,date(
"m") ,date(
"d")+14,date(
"Y")));
30 if (trim($delrow) !=
"") {$action =
"delete row";}
34 survey_update(
"delete survey");
37 confirm($survey, $action);
43 survey_update(
"$action");
50 getsurvey(
"NO MESSAGE");
53 array_splice($xa,$delrow,1);
55 getsurvey(
"NO MESSAGE");
58 showresults(
"$survey");
72 function survey_update($action) {
94 if ($action ==
"add" || $action ==
"save" || $action ==
"save dates") {
95 $sname = (trim($sname) ==
"" ?
"" : $sname);
96 $sstart = (trim($sstart) ==
"" ?
"$today" : $sstart);
97 $sstop = (trim($sstop) ==
"" ?
"$twoweeks" : $sstop);
98 $qtext = (trim($qtext) ==
"" ?
"" : $qtext);
99 $qstyle = (($qstyle == 0 || trim($qstyle) ==
"") ? 1 : $qstyle);
102 $qtext = strip_tags($qtext);
105 if (trim($survey) ==
""){ $msg .=
"<li>Please Select a survey</li>\n"; }
106 if (preg_match(
"/^ *$/",$survey)) { $msg .=
"<li>Invalid survey ID</li>\n";}
107 if (($starttime = strtotime($sstart)) === -1) {
108 $msg .=
"<li>Invalid Start Date</li>\n";
110 list($mm,$dd,$yyyy) = explode(
"/",$sstart);
111 if (!checkdate(
"$mm",
"$dd",
"$yyyy")) {
112 $msg .=
"<li>Invalid Start Date</li>\n";}
114 if (($stoptime = strtotime($sstop)) === -1) {
115 $msg .=
"<li>Invalid Stop Date</li>\n";
117 list($mm,$dd,$yyyy) = explode(
"/",$sstop);
118 if (!checkdate(
"$mm",
"$dd",
"$yyyy")) {
119 $msg .=
"<li>Invalid Stop Date</li>\n";}
121 if ($starttime > $stoptime) {
122 $msg .=
"<li>Start Date must be before Stop Date</li>\n";}
124 if (strlen($qtext) > 500) {
126 $msg .=
"<li>Question text is too long. Maximum length is 500 characters. You have typed an additional " . ($l - 500) .
" characters, please remove some characters and try again.</li>\n";}
132 case "delete survey":
134 $sql =
"delete from cuadmin_surveymaster 135 where surveyid='$survey'; 136 delete from cuadmin_surveydetail where surveyid='$survey';";
137 $sql .=
"delete from cuadmin_surveysays 138 where surveyid='$survey';";
141 $sname=prep_save($sname);
142 $qtext=prep_save($qtext);
144 $sql=
"update cuadmin_surveymaster set 145 startdate='$sstart', stopdate='$sstop', 146 surveyname='$sname', question='$qtext', 147 qstyle='$qstyle', runstat=$rstat 148 where surveyid='$survey'";
150 $sql .=
";delete from cuadmin_surveysays 151 where surveyid='$survey'; 152 delete from cuadmin_surveydetail 153 where surveyid='$survey';";
155 for ($prow=0; $prow < $showrows; $prow++) {
156 $answerid = $xa[$prow][0];
157 $answertext = $xa[$prow][1];
159 if ( trim($answertext) !=
"") {
160 $answertext = prep_save(strip_tags($answertext));
161 $sql .=
"insert into cuadmin_surveydetail 162 (surveyid, answerid, answertext) 164 ('$survey','$drow','$answertext');\n";
171 $sql=
"update cuadmin_surveymaster set 174 where surveyid = $survey";
180 $sname=prep_save($sname);
181 $qtext=prep_save($qtext);
182 $sql =
"insert into cuadmin_surveymaster (surveyid, startdate, 183 stopdate, surveyname, question, qstyle, runstat) 185 nextval('cuadmin_surveymast_surveyid_seq'), 186 '$sstart','$sstop','$sname','$qtext', 187 '$qstyle', $rstat);";
189 for ($prow=0; $prow < $showrows; $prow++) {
190 $answerid = $xa[$prow][0];
191 $answertext = strip_tags($xa[$prow][1]);
193 if ( trim($answertext) !=
"") {
194 $answertext = prep_save(strip_tags($answertext));
195 $sql .=
"insert into cuadmin_surveydetail 196 (surveyid, answerid, answertext) 198 (currval('cuadmin_surveymast_surveyid_seq'), 199 '$drow','$answertext');\n";
204 $sth = db_query($sql,$link);
205 $msg = pg_errormessage();
206 if ($msg ==
"") { update_success($what);}
208 db_free_result($sth);
215 case "delete survey":
225 function getsurvey($msg) {
246 cu_header(
"List Admin Surveys");
247 $url_view =
"&viewmsg=1";
250 <script language=
"javascript">
252 function show_preview(status) {
253 var marker=
"Admin_SurveyView.prg?showid=";
254 helpwin=window.open(marker + status,
"_Preview",
"toolbar=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=600,height=380");
261 if (trim($survey)==
"") {
262 $urlfindadd=urlencode(
"Find or Add");
263 $urldelsurvey=urlencode(
"Delete Survey");
266 $sql=
"select surveyid, surveyname, 267 to_char(startdate,'mm/dd/yy'), 268 to_char(stopdate,'mm/dd/yy'), 269 case when stopdate < CURRENT_DATE then 3 270 when startdate > CURRENT_DATE then 1 271 else 2 end as datestat, 273 from cuadmin_surveymaster 274 order by 5, 4 desc, 3 desc";
276 $sth = db_query($sql,$link);
278 <div align=center><br><form action=
"$self">
279 <table border=0 width=600 cellpadding=0 cellspacing=2
class=
'dmsbg'><tr><td>
280 <table width=600 cellspacing=0 cellpadding=3 border=0 bgcolor=
"#EDEDED">
281 <tr><td
class=
"bar" colspan=4 align=center>$pg_ttl</td></tr>
283 if (
"$msg" !=
"NO MESSAGE") {
285 <tr><td
class=
"msg" align=right><img src=
'/monitor/images/alert.black.gif'></td>
286 <td
class=
"msg" colspan=3>$msg</td></tr>
290 <tr><td
class=
'dtl' align=
'left' colspan=4>
295 <tr><td align=
'left' colspan=
"2"><b> <a href=
"/hcuadm/cuilist.prg" target=
"parent">Credit Union List</a></td></tr>
296 <tr><td align=
'right'><b> See Results: </b></td>
297 <td><a href=
'$self?survey=ALL&action=results' class=
"white_link">All Surveys</a>
298 <a href=
'$self?survey=PAST&action=results' class=
"white_link">Past Surveys</a>
299 <a href=
'$self?survey=PRESENT&action=results' class=
"white_link">Present Surveys</a>
303 <tr><td align=
'right'><b> Preview: </b></td>
304 <td><a href=
'javascript:show_preview("ALL")' class=
"white_link">All Surveys</a>
305 <a href=
'javascript:show_preview("DRAFT")' class=
"white_link">Draft Surveys</a>
306 <a href=
'javascript:show_preview("PRESENT")' class=
"white_link">Present Surveys</a>
307 <a href=
'javascript:show_preview("FUTURE")' class=
"white_link">Future Surveys</a>
311 <tr><td
class=
"hdr" NOWRAP>Survey
313 <td
class=
"hdr" NOWRAP>Status
315 <td
class=
"hdr" NOWRAP>Run Dates
317 <td
class=
"hdr" align=
"right">
318 <a href=
"$self?action=${urlfindadd}&survey=new" class=
"white_link">New Survey</a>
322 for ($row=0;list($survey, $sname, $sstart, $sstop, $dstat, $rstat) = db_fetch_array($sth,$row); $row++) {
323 switch ($dstat * $rstat){
337 $urlsname=urlencode(
"$sname");
339 <tr
class=
"{$rbg}"><td
class=
"usul" colspan=
'3'>
340 <a href=
"$self?survey=$survey&action=$urlfindadd">$sname</a></td>
341 <td
class=
"usul"> </td></tr>
342 <tr
class=
"{$rbg}"><td
class=
"usul"> </td>
343 <td
class=
"usul">$sstat</td>
344 <td
class=
"usul">$sstart - $sstop</td>
345 <td
class=
"usul" ><font size=-1>
347 <a href=
"$self?survey=$survey&action=$urlfindadd"> Edit </a> |
352 <a href=
"javascript:show_preview('$survey')"> View </a> |
362 <a href=
"$self?survey=$survey&action=stretchdate"> Extend Date </a> |
367 <font size=
"1">Extend Date</font> |
372 <a href=
"$self?survey=$survey&action=Results"> Results </a> |
375 <a href=
"$self?survey=$survey&action=$urldelsurvey&sname=$urlsname"> Delete </a>
378 $rbg = ($rbg ==
"odd" ?
"even" :
"odd");
381 print
"</table></td></tr></table></form></div>";
385 $warn_msg =
"Warning: Changing this survey will cause all survey results to be deleted!";
389 function sendform(action) {
390 document.forms[0].action.value=action;
391 document.forms[0].submit();
393 function validate(mode, chgrun) {
394 var strSurvey = document.forms[0].survey.value;
396 var patSpaces = /^ *$/;
398 if(!confirm(
"$warn_msg OK to continue?")) {
405 if (strSurvey.length == 0)
406 { strMessage +=
"Please Select a Survey Number.\\n";}
407 if (patSpaces.exec(strSurvey) !=
null)
408 { strMessage +=
"Invalid Survey Number.\\n";}
409 if (strSurvey.indexOf(
"'") != -1 || strSurvey.indexOf(
'"') != -1)
410 { strMessage +=
"Invalid Characters in Survey Number.\\n";}
413 if (strMessage.length > 0) {
417 document.forms[0].action.value=mode;
418 document.forms[0].submit();
424 function submitform(row) {
425 document.forms[0].delrow.value=row;
426 document.forms[0].action.value=
'Delete Row';
427 document.forms[0].submit();
435 $loadform = isset($AddChange);
436 if ($loadform == 0 ) {
438 $sql=
"select answerid, answertext from cuadmin_surveydetail 439 where surveyid='$survey'";
440 $sth = db_query($sql,$link);
441 for ($row=0;list($answerid, $answertext) = db_fetch_array($sth,$row); $row++) {
443 $xa[$row][0]=$answerid;
444 $xa[$row][1]=$answertext;
448 $sql=
"select to_char(startdate,'mm/dd/yyyy'), 449 to_char(stopdate,'mm/dd/yyyy'), 450 surveyname, question, qstyle, runstat 451 from cuadmin_surveymaster 452 where surveyid='$survey'";
453 $sth = db_query($sql,$link);
454 if (list($sstart, $sstop, $sname, $qtext, $qstyle, $rstat)
455 = db_fetch_array($sth,0)) {
457 if ($rstat==1 && $AddChange==
"Save") {
459 print
"<script>alert('$warn_msg');</script>";
465 $sname = (trim($sname) ==
"" ?
"" : $sname);
466 $qtext = (trim($qtext) ==
"" ?
"" : $qtext);
467 $sstart = (trim($sstart) ==
"" ?
"$today" : $sstart);
468 $sstop = (trim($sstop) ==
"" ?
"$twoweeks" : $sstop);
469 $qstyle = (($qstyle == 0 || trim($qstyle) ==
"") ? 1 : $qstyle);
470 $rstat = ($rstat ==
"" ? 0 : $rstat);
473 $sname = (trim($sname) ==
"" ?
"" : $sname);
474 $qtext = (trim($qtext) ==
"" ?
"" : $qtext);
476 <div align=center><br><form name=
"surveyform" action=
"$self" method=
"post">
477 <table border=0 width=400 cellpadding=0 cellspacing=2
class=
'dmsbg'><tr><td>
478 <table width=400 cellspacing=0 cellpadding=3 border=0 bgcolor=
"#FFFFFF">
479 <tr><td
class=
"bar" colspan=2 align=center>$pg_ttl</td></tr>
481 if ($msg !=
"NO MESSAGE") {
482 print
"<tr><td class='msg' colspan=2 align=left> 483 <ul>Error: $msg</ul></font></td></tr>";
485 if ($rstat==1 && $AddChange==
"Save") {
487 print
"<tr><td class='ahd' colspan=2 align=center> 488 Warning: Saving changes to this survey will cause all survey results to be deleted!<br><input type=hidden name=chgrun value=$chgrun></td></tr>";
491 <tr><td
class=
"hdr" colspan=
"2">Survey Details
492 <input type=hidden name=survey value=
"$survey">
493 <input type=hidden name=
"qstyle" value=
"3">
494 <input type=hidden name=
"action" value=
"">
495 <input type=hidden name=
"AddChange" value=
"$AddChange">
498 <tr><td
class=
"small" align=
"right" nowrap>Survey Name </td>
500 <input type=
"text" name=
"sname" size=
"25" maxlength=
"50" value=
"$sname"></td>
502 <tr><td
class=
"small" align=
"right">Run Dates </td>
504 <input type=text name=
"sstart" size=
"10" maxlength=
"10" value=
"$sstart"> to
505 <input type=text name=
"sstop" size=
"10" maxlength=
"10" value=
"$sstop"></td>
508 <tr><td
class=
"small" align=
"right">Status </td><td
class=
"small"><input type=
"radio" name=
"rstat" value=
"1" 510 if ($rstat == 1) {print
" checked";}
512 > Running
513 <input type=
"radio" name=
"rstat" value=
"0" 515 if ($rstat == 0) {print
" checked";}
520 $qtext = disp_msg($qtext);
522 <tr><td colspan=2
class=
"small"><hr width=60%></td></tr>
523 <tr><td
class=
"small" align=
"right" valign=
"top">
527 <textarea cols=
"25" rows=
"6" wrap=
"virtual" name=
"qtext" 528 >$qtext</textarea><br>
533 <tr><td
class=
"small" colspan=2 align=
"right">
534 <input type=button value=
"More Rows" onClick=
"sendform('More Rows')">
535 <input type=hidden name=
"showrows" value=
"$showrows">
536 <input type=hidden name=
"delrow" value=
"">
538 <table width=400 cellspacing=0 cellpadding=3 border=0>
539 <tr><td
class=
"hdr">Possible Answers</td></tr>
541 for ($prow=0; $prow < $showrows; $prow++) {
542 print
"<tr><td class=\"dtl\"><input type=\"hidden\" 543 name=\"xa[$prow][0]\" value=\"" . $xa[$prow][0] .
"\">";
544 print
"<input type=\"text\" 545 size=\"37\" maxlength=\"50\" 546 name=\"xa[$prow][1]\" value=\"" . $xa[$prow][1] .
"\">";
547 print
" <input type=\"button\" 549 onClick='submitform(\"$prow\");'> 553 <tr><td
class=
"hdr" colspan=2 align=center><hr>
554 <input type=button value=
"$AddChange" onClick=
"validate('$AddChange','$chgrun');">
556 if ($AddChange ==
"Save") {
558 <input type=button value=
"Delete Survey" onClick=
"sendform('Delete Survey');"><a href=
'javascript:show_help("$helpdoc#edit_delete");'>$helpicon</a>
564 print
"<input type=button value=\"Cancel\" onClick=\"sendform('Cancel');\"> 565 </td></tr></table></td></tr></table></form></div>";
570 function stretchdate($msg) {
580 header(
"Expires: Sat 20 May 1995 03:32:38 GMT");
581 header(
"Pragma: no-cache");
582 header(
"Cache-Control: no-cache, must-revalidate");
583 cu_header(
"Stretch Admin Surveys");
585 <script language=
"javascript">
587 function show_help(marker)
589 helpwin=window.open(marker,
"_Help",
"toolbar=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=500,height=340");
598 if (trim($survey)==
"") {
603 function sendform(action)
605 document.forms[0].action.value=action;
606 document.forms[0].submit();
611 $sql =
"select to_char(startdate,'mm/dd/yyyy') as sstart, 612 to_char(stopdate,'mm/dd/yyyy') as sstop, 613 m.surveyname, question, answertext 614 from cuadmin_surveymaster m, cuadmin_surveydetail d 615 where m.surveyid = $survey 616 and m.surveyid = d.surveyid 617 order by stopdate, m.surveyid, answerid";
619 $sth = db_query($sql,$link);
621 if (db_num_rows($sth) == 0 ) {
626 # get just the first row and format the heading 628 list( $sstart, $sstop, $sname, $qtext, $atext ) =
629 db_fetch_array($sth,$row);
631 $sname = (trim($sname) ==
"" ?
"" : $sname);
632 $qtext = (trim($qtext) ==
"" ?
"" : $qtext);
633 $sstart = (trim($sstart) ==
"" ?
"$today" : $sstart);
634 $sstop = (trim($sstop) ==
"" ?
"$twoweeks" : $sstop);
635 $atext = (trim($atext) ==
"" ?
"" : $atext);
638 <div align=center><br><form name=
"dateform" action = $self>
639 <table border=0 width=400 cellpadding=0 cellspacing=2
class=
'dmsbg'><tr><td>
640 <table width=400 cellspacing=0 cellpadding=3 border=0>
641 <tr><td
class=
"bar" colspan=2 align=center>HomeCU Survey Date Change</td></tr>
643 if ($msg !=
"NO MESSAGE") {
644 print
"<tr><td class='msg' colspan=2 align=left> 645 <ul>Error: $msg</ul></font></td></tr>";
648 <tr><td
class=
"hdr" colspan=2>
649 <input type=hidden name=survey value=
"$survey">
650 <input type=hidden name=
"action" value=
""></td>
652 <tr><td
class=
"small" align=
"right">Survey Name <a href=
'javascript:show_help("$helpdoc#name");'>$helpicon</a> </td>
653 <td
class=
"small">$sname</td>
655 <tr><td
class=
"small" align=
"right">Run Dates <a href=
'javascript:show_help("$helpdoc#dates");'>$helpicon</a> </td>
657 <input type=text name=
"sstart" size=
"10" maxlength=
"10" value=
"$sstart">
659 <input type=text name=
"sstop" size=
"10" maxlength=
"10" value=
"$sstop"></td>
661 <tr><td colspan=2
class=
"small"><hr width=60%></td></tr>
662 <tr><td
class=
"small"> </td>
663 <td
class=
"small">
664 <input type=button value=
"Save Dates" onClick=
"sendform('Save Dates');"><a href=
'javascript:show_help("$helpdoc#savedate");'>$helpicon</a>
665 <input type=button value=
"Cancel" onClick=
"sendform('Cancel');"><a href=
'javascript:show_help("$helpdoc#cancel");'>$helpicon</a></td></tr>
666 </table></td></tr></table></form>
668 <table border=0 width=400 cellpadding=0 cellspacing=2
class=
'dmsbg'><tr><td>
669 <table border=0 CELLSPACING=0 CELLPADDING=3 width=400>
670 <tr><td CLASS=ahd>$qtext</td></tr>
671 <tr><td
class=
'dtl'> <font size=-1>$atext</font></td></tr>
675 # Now get the rest of the rows and format the possible answers 678 for ($row=1; list( $sstart, $sstop, $sname, $qtext, $atext ) =
679 db_fetch_array($sth,$row); $row++) {
682 <tr><td
class=
'dtl'> <font size=-1>$atext</font></td></tr>
686 print
"</table></td></tr></table></div>";
687 db_free_result($sth);
693 function confirm($survey, $action) {
701 getsurvey(
"You must enter a survey number");
704 header(
"Expires: Sat 20 May 1995 03:32:38 GMT");
705 header(
"Pragma: no-cache");
706 header(
"Cache-Control: no-cache, must-revalidate");
707 cu_header(
"Delete Admin Survey");
708 $sname = (trim($sname) ==
"" ?
"" : $sname);
711 <div align=center><br><form action=
"$self">
712 <table border=0 width=500 cellpadding=0 cellspacing=2
class=
'dmsbg'><tr><td>
713 <table width=500 cellspacing=0 cellpadding=4 border=0>
714 <tr><td
class=
"bar" colspan=2 align=center>$pg_ttl</td></tr>
715 <tr><td
class=
"ahd" colspan=2 align=center>Warning! This action will
delete all data<br> (question, answers, and member responses) <br>
for survey
'$sname'. <br><br>Do you wish to
continue?</td></tr>
718 <tr><td
class=
"hdr" colspan=2><hr></td>
719 <tr><td
class=
"hdr" align=right>
720 <input type=submit name=
"action" value=
"Yes">
722 <td
class=
"hdr" align=left>
723 <input type=submit name=
"action" value=
"No">
728 <input type=hidden name=
"survey" value=
"$survey">
729 <input type=hidden name=
"todelete" value=
"delete survey">
734 function showresults($survey) {
741 $today = date(
"m/d/y");
743 cu_header(
"Show Admin Surveys");
746 <script language=
"javascript">
748 function show_help(marker)
750 helpwin=window.open(marker,
"_Help",
"toolbar=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=500,height=340");
760 <table border=0 width=500 cellpadding=0 cellspacing=2
class=
'dmsbg'><tr><td>
761 <table border=0 align=center width=
'500' cellspacing=0>
762 <tr><td
class=
'bar' colspan=
'3' align=
'center'>
763 HomeCu Survey Results</td></tr></table>
764 <table border=0 align=center width=
'500' cellspacing=0>
765 <tr><td
class=
'dtl' align=
'left'>
766 <a href=
'$self'>Survey Menu</a><a href=
'javascript:show_help("$helpdoc#menu");'>$helpicon</a> <b> See Results: </b>
767 <a href=
'$self?survey=ALL&action=results'>All Survey</a>
768 <a href=
'$self?survey=PAST&action=results'>Past Survey</a>
769 <a href=
'$self?survey=PRESENT&action=results'>Present Survey</a>
779 $sclause =
" where runstat = 1 and m.startdate <= CURRENT_DATE and m.stopdate >= CURRENT_DATE ";
782 $sclause =
" where m.stopdate < CURRENT_DATE ";
785 $sclause =
" where m.surveyid = $survey ";
788 $sql =
"select d.surveyid, to_char(m.startdate,'mm/dd/yy') as sstart, 789 to_char(m.stopdate,'mm/dd/yy') as sstop, 790 m.question, d.answerid, d.answertext, 792 from (cuadmin_surveydetail d join cuadmin_surveymaster m on 793 (d.surveyid=m.surveyid)) 794 left join cuadmin_surveysays s on 795 (d.surveyid = s.surveyid 796 and d.answerid = s.answerid) 798 group by d.surveyid, m.startdate, m.stopdate, m.question, d.answerid, d.answertext 800 select m.surveyid, to_char(m.startdate,'mm/dd/yy') as sstart, 801 to_char(m.stopdate,'mm/dd/yy') as sstop, 802 m.question, -1::int4 as answerid, 803 'Total'::varchar as answertext, count(s.cu) 804 from cuadmin_surveymaster m left join cuadmin_surveysays s 805 on (m.surveyid = s.surveyid) 807 group by m.surveyid, m.startdate, m.stopdate, m.question, answertext 810 $sth = db_query($sql,$link);
811 $ilist=array(
'green',
'red',
'blue',
'orange',
'purple',
'olive',
'aqua',
'brown',
'yellow');
812 for ($row=0; list( $sid, $sstart, $sstop, $qtext, $aid, $atext, $votes ) =
813 db_fetch_array($sth,$row); $row++) {
816 if ($cur_sid !=
"$sid"){
818 # if not first question 820 if ($cur_sid !=
"" ) {
821 echo
"<tr><td class='dtl'> </td> 822 <td class='dtl'><font size=-1>Total Votes: </font></td> 823 <td class='dtl'><font size=-1>$totalvotes</font></td></tr> 824 <tr><td colspan=3 class='dtl'><hr></td></tr></table>";
827 $totalvotes = $votes;
829 echo
"<table border=0 CELLSPACING=0 CELLPADDING=3 width=500 align='center'>\n 830 <tr><td class='dtl'><font size=-1><b>Survey Dates:</b> $sstart to $sstop</font></td> 831 <td align=right colspan=2 class='dtl'><font size=-1><b>Results as of: </b>$today</font></td></tr> 832 <tr><td CLASS=ahd colspan=3>$qtext</td></tr>";
837 if ($totalvotes > 0) {
838 $wide = (($votes / $totalvotes) * 100);
839 $wide = sprintf(
"%3.1f",$wide);
843 $color= current($ilist);
844 if (!next($ilist)) {reset($ilist);}
847 <tr><td width=
'60%' class=
'dtl'><font size=-1>$atext</font></td>
848 <td width=140
class=
'dtl'>
851 print
"<img src='/monitor/images/graph/graph_${color}.gif' 852 height='10' width='$wide'><font size=-1>${wide}%</font></td>";
857 <td
class=
'dtl'><font size=-1>$votes votes</font></td>
863 if ($cur_sid !=
"" ) {
864 echo
"<tr><td class='dtl'> </td> 865 <td class='dtl'><font size=-1>Total Votes: </font></td> 866 <td class='dtl'><font size=-1>$totalvotes</font></td></tr> 867 <tr><td colspan=3 class='dtl'><hr></td></tr></table>";
869 echo
"</td></tr></table>";
872 function update_success($what) {
877 $msg=urlencode(
"Survey $what Successfully");
878 header(
"Location: $main_url?msg=$msg");
880 function disp_msg($msg) {
881 return htmlspecialchars(trim($msg));
883 function error_exit($reason) {
887 <TABLE BORDER=0 CELLPADDING=6 WIDTH=90%>
888 <tr><td CLASS=
"bar" align=
"center">HomeCU $pg_ttl
890 <td
class=
'hdr' align=
'center'>
891 Unable to complete your request</td></tr>
892 <tr><td
class=
'dtl' align=
'center'>