[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_plugins/poll/ -> oldpolls.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/oldpolls.php,v $
  14  |     $Revision: 1.13 $
  15  |     $Date: 2007/02/16 20:48:23 $
  16  |     $Author: e107steved $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("../../class2.php");
  20  require_once(HEADERF);
  21  require_once(e_HANDLER."comment_class.php");
  22  $cobj = new comment;
  23  $gen = new convert;
  24  if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
  25  
  26  
  27  @include(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
  28  @include(e_PLUGIN."poll/languages/English.php");
  29  
  30  
  31  if(e_QUERY)
  32  {
  33      $query = "SELECT p.*, u.user_id, u.user_name FROM #polls AS p
  34      LEFT JOIN #user AS u ON p.poll_admin_id = u.user_id
  35      WHERE p.poll_type=1 AND p.poll_id=".intval(e_QUERY);
  36  
  37      if($sql->db_Select_gen($query))
  38      {
  39  
  40          $row = $sql -> db_Fetch();
  41          extract($row);
  42  
  43          $optionArray = explode(chr(1), $poll_options);
  44          $optionArray = array_slice($optionArray, 0, -1);
  45          $voteArray = explode(chr(1), $poll_votes);
  46          $voteArray = array_slice($voteArray, 0, -1);
  47  
  48          $voteTotal = array_sum($voteArray);
  49          $percentage = array();
  50          foreach($voteArray as $votes)
  51          {
  52              $percentage[] = round(($votes/$voteTotal) * 100, 2);
  53          }
  54  
  55          $start_datestamp = $gen->convert_date($poll_datestamp, "long");
  56          $end_datestamp = $gen->convert_date($poll_end_datestamp, "long");
  57  
  58          $text = "<table style='".USER_WIDTH."'>
  59          <tr>
  60          <td colspan='2' class='mediumtext' style='text-align:center'>
  61          <b>".$tp -> toHTML($poll_title)."</b>
  62          <div class='smalltext'>".POLLAN_35." <a href='".e_BASE."user.php?id.{$user_id}'>".$user_name."</a>.<br /> ".POLLAN_37." ".$start_datestamp." ".POLLAN_38." ".$end_datestamp.".<br />".POLLAN_26.": {$voteTotal}</div>
  63          <br />
  64  
  65          </td>
  66          </tr>";
  67  
  68          $count = 0;
  69  
  70          $barl = (file_exists(THEME."images/barl.png") ? THEME."images/barl.png" : e_PLUGIN."poll/images/barl.png");
  71          $barr = (file_exists(THEME."images/barr.png") ? THEME."images/barr.png" : e_PLUGIN."poll/images/barr.png");
  72          $bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_PLUGIN."poll/images/bar.png");
  73  
  74          foreach($optionArray as $option)
  75          {
  76              $text .= "<tr>
  77              <td style='width:40%; text-align: right' class='mediumtext'><b>".$tp -> toHTML($option)."</b>&nbsp;&nbsp;</td>
  78              <td class='smalltext'>
  79  
  80  
  81              <div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".(floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 95)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div>".$percentage[$count]."% [".POLLAN_31.": ".$voteArray[$count]."]</div>
  82              </td>
  83              </tr>\n";
  84              $count++;
  85  
  86          }
  87  
  88          $query = "SELECT c.*, u.* FROM #comments AS c
  89          LEFT JOIN #user AS u ON FLOOR(SUBSTR(c.comment_author,1,INSTR(c.comment_author,'.')-1))=u.user_id
  90          WHERE comment_item_id=".intval($poll_id)." AND comment_type=4 ORDER BY comment_datestamp";
  91          if ($comment_total = $sql->db_Select_gen($query) !== FALSE)
  92          {
  93              $text .= "<tr><td colspan='2'><br /><br />";
  94              while ($row = $sql->db_Fetch()) {
  95                  $text .= $cobj->render_comment($row);
  96              }
  97              $text .= "</td></tr>";
  98          }
  99  
 100          $text .= "</table>";
 101          $ns->tablerender(POLL_ADLAN01." #".$poll_id, $text);
 102      }
 103  }
 104  
 105  $query = "SELECT p.*, u.user_name FROM #polls AS p
 106  LEFT JOIN #user AS u ON p.poll_admin_id = u.user_id
 107  WHERE p.poll_type=1
 108  ORDER BY p.poll_datestamp DESC";
 109  
 110  if(!$sql->db_Select_gen($query))
 111  {
 112      $ns->tablerender(POLLAN_28, "<div style='text-align:center'>".POLLAN_33."</div>");
 113      require_once(FOOTERF);
 114      exit;
 115  }
 116  
 117  $array = $sql -> db_getList();
 118  $oldpollArray = array_slice($array, 1);
 119  
 120  if(!count($oldpollArray))
 121  {
 122      $ns->tablerender(POLLAN_28, "<div style='text-align:center'>".POLLAN_33."</div>");
 123      require_once(FOOTERF);
 124      exit;
 125  }
 126  
 127  $text = "<table class='fborder' style='".USER_WIDTH."'>
 128  <tr>
 129  <td class='fcaption' style='width: 55%;'>".POLLAN_34."</td>
 130  <td class='fcaption' style='width: 15%;'>".POLLAN_35."</td>
 131  <td class='fcaption' style='width: 30%;'>".POLLAN_36."</td>
 132  </tr>\n";
 133  
 134  foreach($oldpollArray as $oldpoll)
 135  {
 136      extract($oldpoll);
 137      $from = $gen->convert_date($poll_datestamp, "short");
 138      $to = $gen->convert_date($poll_end_datestamp, "short");
 139  
 140      $text .= "<tr>
 141      <td class='forumheader3' style='width: 55%;'><a href='".e_SELF."?$poll_id'>$poll_title</a></td>
 142      <td class='forumheader3' style='width: 15%;'><a href='".e_BASE."user.php?id.$poll_admin_id'>$user_name</a></td>
 143      <td class='forumheader3' style='width: 30%;'>$from ".POLLAN_38." $to</td>
 144      </tr>\n";
 145  }
 146  
 147  $text .= "</table>";
 148  $ns->tablerender(POLLAN_28, $text);
 149  require_once(FOOTERF);
 150  
 151  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7