// // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // You may not change or alter any portion of this comment or credits // // of supporting developers from this source code or any supporting // // source code which is considered copyrighted (c) material of the // // original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // // Project: The XOOPS Project // // ------------------------------------------------------------------------- // include_once XOOPS_ROOT_PATH."/modules/xoopspoll/language/".$xoopsConfig['language']."/main.php"; class XoopsPollRenderer { // private // XoopsPoll class object var $poll; // constructor function XoopsPollRenderer(&$poll) { $this->poll =& $poll; } // public function renderForm() { $content = "
\n"; return $content; } function assignForm(&$tpl) { $options_arr =& XoopsPollOption::getAllByPollId($this->poll->getVar("poll_id")); $option_type = "radio"; $option_name = "option_id"; if ( $this->poll->getVar("multiple") == 1 ) { $option_type = "checkbox"; $option_name .= "[]"; } $i = 0; foreach ( $options_arr as $option ) { $options[$i]['input'] = ""; $options[$i]['text'] = $option->getVar("option_text"); $i++; } $tpl->assign('poll', array('question' => $this->poll->getVar("question"), 'pollId' => $this->poll->getVar("poll_id"), 'viewresults' => XOOPS_URL."/modules/xoopspoll/pollresults.php?poll_id=".$this->poll->getVar("poll_id"), 'action' => XOOPS_URL."/modules/xoopspoll/index.php", 'options' => $options)); } // public function renderResults() { if ( !$this->poll->hasExpired() ) { $end_text = sprintf(_PL_ENDSAT, formatTimestamp($this->poll->getVar("end_time"), "m")); } else { $end_text = sprintf(_PL_ENDEDAT, formatTimestamp($this->poll->getVar("end_time"), "m")); } echo "".$this->poll->getVar("question")." |
$end_text |
".$option->getVar("option_text")." | ";
if ( $percent > 0 ) {
$width = intval($percent)*2;
echo " |
".sprintf(_PL_TOTALVOTES, $total)." ".sprintf(_PL_TOTALVOTERS, $this->poll->getVar("voters")).""; if ( !$this->poll->hasExpired() ) { echo " ["._PL_VOTE."]"; } echo " |