phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: polls/inc hook_website_left.inc.php,NONE,1.1 hoo


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: polls/inc hook_website_left.inc.php,NONE,1.1 hook_website_right.inc.php,NONE,1.1 functions.inc.php,1.11,1.12
Date: Wed, 20 Feb 2002 08:42:23 -0500

Update of /cvsroot/phpgroupware/polls/inc
In directory subversions:/tmp/cvs-serv16801/inc

Modified Files:
        functions.inc.php 
Added Files:
        hook_website_left.inc.php hook_website_right.inc.php 
Log Message:
modify display to echo or return values for use in website; add website hooks



***** Error reading new file: [Errno 2] No such file or directory: 
'hook_website_left.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'hook_website_right.inc.php'
Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/polls/inc/functions.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** functions.inc.php   21 Dec 2001 14:59:46 -0000      1.11
--- functions.inc.php   20 Feb 2002 13:42:21 -0000      1.12
***************
*** 50,54 ****
        }
  
!       function poll_viewResults($poll_id)
        {
                $GLOBALS['phpgw']->db->query("SELECT SUM(option_count) AS sum 
FROM phpgw_polls_data WHERE poll_id='$poll_id'",__LINE__,__FILE__);
--- 50,54 ----
        }
  
!       function poll_viewResults($poll_id,$website=False)
        {
                $GLOBALS['phpgw']->db->query("SELECT SUM(option_count) AS sum 
FROM phpgw_polls_data WHERE poll_id='$poll_id'",__LINE__,__FILE__);
***************
*** 59,64 ****
                $GLOBALS['phpgw']->db->next_record();
  
!               echo '<p><table border="0" align="center" width="50%">';
!               echo ' <tr>' . "\n"
                        . '  <td colspan="3" bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg'] . '" align="center">'
                        . $GLOBALS['phpgw']->db->f('poll_title') . '</td>' . 
"\n"
--- 59,64 ----
                $GLOBALS['phpgw']->db->next_record();
  
!               $out  = '<p><table border="0" align="center" width="50%">';
!               $out .= ' <tr>' . "\n"
                        . '  <td colspan="3" bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg'] . '" align="center">'
                        . $GLOBALS['phpgw']->db->f('poll_title') . '</td>' . 
"\n"
***************
*** 72,80 ****
  
                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
!                       echo ' <tr bgcolor="' . $tr_color . '">' . "\n";
  
                        if ($poll_optionText != '')
                        {
!                               echo "  <td>$poll_optionText</td>\n";
  
                                if ($poll_sum)
--- 72,80 ----
  
                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
!                       $out .= ' <tr bgcolor="' . $tr_color . '">' . "\n";
  
                        if ($poll_optionText != '')
                        {
!                               $out .= "  <td>$poll_optionText</td>\n";
  
                                if ($poll_sum)
***************
*** 90,94 ****
                                {
                                        $poll_percentScale = 
(int)($poll_percent * 1);
!                                       echo '  <td><img src="' . 
$GLOBALS['phpgw_info']['server']['webserver_url']
                                                . '/polls/images/pollbar.gif" 
height="12" width="' . $poll_percentScale
                                                . '"></td>' . "\n";
--- 90,94 ----
                                {
                                        $poll_percentScale = 
(int)($poll_percent * 1);
!                                       $out .= '  <td><img src="' . 
$GLOBALS['phpgw_info']['server']['webserver_url']
                                                . '/polls/images/pollbar.gif" 
height="12" width="' . $poll_percentScale
                                                . '"></td>' . "\n";
***************
*** 96,112 ****
                                else
                                {
!                                       echo '  <td>&nbsp;</td>' . "\n";
                                }
  
!                               printf('  <td> %.2f %% (%d)</td>' . "\n" . ' 
</tr>' . "\n", $poll_percent, $poll_optionCount);
  
!                               echo ' </tr>' . "\n";
                        }
                }
  
!               echo ' <tr bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['bgcolor'] . '">' . "\n"
                        . '  <td>' . lang('Total votes') . ': ' . $poll_sum . 
'</td>' . "\n"
                        . ' </tr>' . "\n"
                        . '</table>' . "\n";
        }
  
--- 96,121 ----
                                else
                                {
!                                       $out .= '  <td>&nbsp;</td>' . "\n";
                                }
  
!                               $out .= printf('  <td> %.2f %% (%d)</td>' . 
"\n" . ' </tr>' . "\n", $poll_percent, $poll_optionCount);
  
!                               $out .= ' </tr>' . "\n";
                        }
                }
  
!               $out .= ' <tr bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['bgcolor'] . '">' . "\n"
                        . '  <td>' . lang('Total votes') . ': ' . $poll_sum . 
'</td>' . "\n"
                        . ' </tr>' . "\n"
                        . '</table>' . "\n";
+ 
+               if($website)
+               {
+                       return $out;
+               }
+               else
+               {
+                       echo $out;
+               }
        }
  
***************
*** 142,148 ****
        }
  
!       function poll_generateUI($poll_id = '')
        {
!               if (! $poll_id)
                {
                        $GLOBALS['phpgw']->db->query("select max(poll_id) from 
phpgw_polls_desc",__LINE__,__FILE__);
--- 151,157 ----
        }
  
!       function poll_generateUI($poll_id='',$website=False)
        {
!               if(!$poll_id)
                {
                        $GLOBALS['phpgw']->db->query("select max(poll_id) from 
phpgw_polls_desc",__LINE__,__FILE__);
***************
*** 151,155 ****
                }
  
!               if (! verify_uservote($poll_id))
                {
                        return False;
--- 160,164 ----
                }
  
!               if(!verify_uservote($poll_id))
                {
                        return False;
***************
*** 159,167 ****
                $GLOBALS['phpgw']->db->next_record();
  
!               echo "\n";
!               echo '<form action="' . 
$GLOBALS['phpgw']->link('/polls/vote.php') . '" method="post">' . "\n";
!               echo '<input type="hidden" name="poll_id" value="' . $poll_id . 
'">' . "\n";
! //            echo '<input type="hidden" name="poll_forwarder" value="' . 
$poll_forwarder . '">';
!               echo '<table border="0" align="center" width="50%">' . "\n"
                        . ' <tr>' . "\n"
                        . '  <td colspan="2" bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg'] . '" align="center">&nbsp;'
--- 168,176 ----
                $GLOBALS['phpgw']->db->next_record();
  
!               $out  = "\n";
!               $out .= '<form action="' . 
$GLOBALS['phpgw']->link('/polls/vote.php') . '" method="post">' . "\n";
!               $out .= '<input type="hidden" name="poll_id" value="' . 
$poll_id . '">' . "\n";
! //            $out .= '<input type="hidden" name="poll_forwarder" value="' . 
$poll_forwarder . '">';
!               $out .= '<table border="0" align="center" width="50%">' . "\n"
                        . ' <tr>' . "\n"
                        . '  <td colspan="2" bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg'] . '" align="center">&nbsp;'
***************
*** 170,177 ****
  
                $GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_polls_data 
WHERE poll_id='$poll_id'",__LINE__,__FILE__);
!               while ($GLOBALS['phpgw']->db->next_record())
                {
                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
!                       echo ' <tr bgcolor="' . $tr_color . '">' . "\n"
                                . '  <td align="center"><input type="radio" 
name="poll_voteNr" value="'
                                . $GLOBALS['phpgw']->db->f('vote_id') . 
'"></td>' . "\n"
--- 179,186 ----
  
                $GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_polls_data 
WHERE poll_id='$poll_id'",__LINE__,__FILE__);
!               while($GLOBALS['phpgw']->db->next_record())
                {
                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
!                       $out .= ' <tr bgcolor="' . $tr_color . '">' . "\n"
                                . '  <td align="center"><input type="radio" 
name="poll_voteNr" value="'
                                . $GLOBALS['phpgw']->db->f('vote_id') . 
'"></td>' . "\n"
***************
*** 180,184 ****
                }
  
!               echo ' <tr bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['bgcolor'] . '">' . "\n"
                        . '  <td colspan="2">&nbsp;</td>' . "\n"
                        . ' </tr>' . "\n"
--- 189,193 ----
                }
  
!               $out .= ' <tr bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['bgcolor'] . '">' . "\n"
                        . '  <td colspan="2">&nbsp;</td>' . "\n"
                        . ' </tr>' . "\n"
***************
*** 188,202 ****
                        . ' </tr>' . "\n"
                        . '</table>' . "\n" . '</form>' . "\n";
        }
  
!       function display_poll()
        {
!               if (! verify_uservote($GLOBALS['poll_settings']['currentpoll']))
                {
!                       
poll_viewResults($GLOBALS['poll_settings']['currentpoll']);
                }
                else
                {
!                       
poll_generateUI($GLOBALS['poll_settings']['currentpoll']);
                }
        }
--- 197,220 ----
                        . ' </tr>' . "\n"
                        . '</table>' . "\n" . '</form>' . "\n";
+ 
+               if($website)
+               {
+                       return $out;
+               }
+               else
+               {
+                       echo $out;
+               }
        }
  
!       function display_poll($website=False)
        {
!               if(!verify_uservote($GLOBALS['poll_settings']['currentpoll']))
                {
!                       return 
poll_viewResults($GLOBALS['poll_settings']['currentpoll'],$website);
                }
                else
                {
!                       return 
poll_generateUI($GLOBALS['poll_settings']['currentpoll'],$website);
                }
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]