mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Forum/Poll template work.
This commit is contained in:
@@ -131,16 +131,21 @@ if ($thread->message)
|
||||
e107::getMessage()->add($thread->message);
|
||||
}
|
||||
|
||||
if (isset($thread->threadInfo['thread_options']['poll']))
|
||||
{
|
||||
if (!defined('POLLCLASS'))
|
||||
{
|
||||
include (e_PLUGIN . 'poll/poll_class.php');
|
||||
}
|
||||
|
||||
|
||||
//if (isset($thread->threadInfo['thread_options']['poll'])) //XXX Currently Failing - misconfigured thread-options.
|
||||
//{
|
||||
$_qry = 'SELECT * FROM `#polls` WHERE `poll_datestamp` = ' . $thread->threadId;
|
||||
$poll = new poll;
|
||||
$pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>';
|
||||
}
|
||||
if($sql->gen($_qry))
|
||||
{
|
||||
if (!defined('POLLCLASS'))
|
||||
{
|
||||
include_once(e_PLUGIN . 'poll/poll_class.php');
|
||||
}
|
||||
$poll = new poll;
|
||||
$pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>';
|
||||
}
|
||||
//}
|
||||
//Load forum templates
|
||||
// FIXME - new template paths!
|
||||
if (file_exists(THEME . 'forum_design.php'))
|
||||
|
@@ -130,22 +130,112 @@ class plugin_forum_post_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
function sc_forumattachment()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
global $forum;
|
||||
|
||||
//. <div>".($pref['image_post'] ? "Attach file / image" : "Attach file")."</div>
|
||||
|
||||
$tooltip = "Allowed file types | ".vartrue($allowed_filetypes).". Any other file type will be deleted instantly.
|
||||
Maximum file size: ".(vartrue($max_upload_size) ? $max_upload_size."bytes" : ini_get('upload_max_filesize'));
|
||||
|
||||
$fileattach = "
|
||||
|
||||
|
||||
<div>
|
||||
<div id='fiupsection'>
|
||||
<span id='fiupopt'>
|
||||
<input class='tbox e-tip' title=\"".$tooltip."\" name='file_userfile[]' type='file' size='47' />
|
||||
</span>
|
||||
</div>
|
||||
<input class='btn button' type='button' name='addoption' value=\"Add Another\" onclick=\"duplicateHTML('fiupopt','fiupsection')\" />
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
if ($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
|
||||
{
|
||||
return $fileattach;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sc_postoptions($parm='')
|
||||
{
|
||||
$type = $this->sc_postthreadas();
|
||||
$poll = $this->sc_poll('front');
|
||||
$attach = $this->sc_forumattachment();
|
||||
|
||||
$text = "
|
||||
<ul class='nav nav-tabs'>
|
||||
<li class='active'><a href='#type' data-toggle='tab'>Type</a></li>";
|
||||
|
||||
$text .= ($poll) ? "<li><a href='#poll' data-toggle='tab'>Poll</a></li>\n" : "";
|
||||
$text .= ($attach) ? "<li><a href='#attach' data-toggle='tab'>Attachment</a></li>\n" : "";
|
||||
|
||||
$text .= "
|
||||
</ul>
|
||||
<div class='tab-content text-left'>
|
||||
<div class='tab-pane active' id='type'>
|
||||
<div class='control-group'>
|
||||
<label class='control-label'>Post thread as:</label>
|
||||
<div class='controls'>
|
||||
".$type."
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
if($poll)
|
||||
{
|
||||
$text .= "<div class='tab-pane' id='poll'>
|
||||
".$poll."
|
||||
</div>";
|
||||
|
||||
}
|
||||
|
||||
if($attach)
|
||||
{
|
||||
$text .= "
|
||||
<div class='tab-pane' id='attach'>
|
||||
".$attach."
|
||||
</div>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</div>";
|
||||
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function sc_poll($parm='')
|
||||
{
|
||||
global $forum, $poll_form, $action;
|
||||
global $forum, $action;
|
||||
|
||||
if(!$poll_form)
|
||||
if(is_readable(e_PLUGIN."poll/poll_class.php"))
|
||||
{
|
||||
if(is_readable(e_PLUGIN."poll/poll_class.php"))
|
||||
{
|
||||
require_once(e_PLUGIN."poll/poll_class.php");
|
||||
$pollo = new poll;
|
||||
$poll_form = $pollo -> renderPollForm("forum");
|
||||
}
|
||||
require_once(e_PLUGIN."poll/poll_class.php");
|
||||
$pollo = new poll;
|
||||
$type = ($parm == 'front') ? 'front' : 'forum';
|
||||
|
||||
$poll_form = $pollo -> renderPollForm($type);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'nt' && check_class($forum->prefs->get('poll')) && strpos(e_QUERY, 'edit') === false)
|
||||
{
|
||||
if($parm == 'front')
|
||||
{
|
||||
return $poll_form;
|
||||
}
|
||||
|
||||
|
||||
return "<tr><td><a href='#pollform' class='e-expandit'>Add Poll</a></td><td>
|
||||
<div id='pollform' style='display:none'>
|
||||
<table class='table table-striped'>".$poll_form."</table></div></td></tr>";
|
||||
@@ -153,22 +243,21 @@ class plugin_forum_post_shortcodes extends e_shortcode
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function sc_postthreadas()
|
||||
{
|
||||
global $action, $threadInfo;
|
||||
|
||||
if (MODERATOR && $action == "nt")
|
||||
{
|
||||
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : vartrue($threadInfo['thread_sticky'])); // no reference of 'head' $threadInfo['head']['thread_sticky']
|
||||
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : vartrue($threadInfo['thread_sticky'],0)); // no reference of 'head' $threadInfo['head']['thread_sticky']
|
||||
|
||||
$opts = array(0 => "Normal", 1 => "Sticky", 2 => "Announcement");
|
||||
|
||||
return e107::getForm()->radio('threadtype',$opts, $thread_sticky);
|
||||
|
||||
|
||||
|
||||
return "<br /><span class='defaulttext'>post thread as
|
||||
<input name='threadtype' type='radio' value='0' ".(!$thread_sticky ? "checked='checked' " : "")." />".LAN_1." <input name='threadtype' type='radio' value='1' ".($thread_sticky == 1 ? "checked='checked' " : "")." />".LAN_2." <input name='threadtype' type='radio' value='2' ".($thread_sticky == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
|
||||
// return "<br /><span class='defaulttext'>post thread as
|
||||
// <input name='threadtype' type='radio' value='0' ".(!$thread_sticky ? "checked='checked' " : "")." />".LAN_1." <input name='threadtype' type='radio' value='1' ".($thread_sticky == 1 ? "checked='checked' " : "")." />".LAN_2." <input name='threadtype' type='radio' value='2' ".($thread_sticky == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
71
e107_plugins/forum/templates/forum_poll_template.php
Normal file
71
e107_plugins/forum/templates/forum_poll_template.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/* v2.x template for forum polls when user has not voted */
|
||||
|
||||
$FORUM_POLL_TEMPLATE = array();
|
||||
|
||||
|
||||
$FORUM_POLL_TEMPLATE['form']['start'] = "
|
||||
<div class='clearfix'>
|
||||
<div class='well span6'>
|
||||
<div class='control-group'>
|
||||
<ul class='nav nav-list'>
|
||||
<li class='nav-header'>
|
||||
Poll: {QUESTION}
|
||||
</li>
|
||||
";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['form']['item'] = "
|
||||
<li>
|
||||
{ANSWER}
|
||||
</li>";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['form']['end'] = "
|
||||
</ul>
|
||||
</div>
|
||||
<div class='control-group'>
|
||||
<div class='controls text-center'>
|
||||
{SUBMITBUTTON}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
|
||||
/* v2.x template for forum polls when user HAS voted */
|
||||
|
||||
$FORUM_POLL_TEMPLATE['results']['start'] = "
|
||||
<div class='clearfix'>
|
||||
<div class='well span6'>
|
||||
<h5>Poll: {QUESTION}</h5>
|
||||
";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['results']['item'] = "
|
||||
<strong>{OPTION}</strong><small class='pull-right'><a href='#' class='e-tip' title=\"{VOTES}\">{PERCENTAGE}</a></small>
|
||||
{BAR}
|
||||
";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['results']['end'] = "
|
||||
<div class='text-center'><small>{VOTE_TOTAL}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -243,23 +243,14 @@ $FORUMPOST_TEMPLATE['form'] = "
|
||||
<td style='width:80%'>
|
||||
{POSTBOX}
|
||||
{EMAILNOTIFY}
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<td style='width:20%'>Post thread as</td>
|
||||
<td style='width:80%'>
|
||||
{POSTTHREADAS}
|
||||
</td></tr>
|
||||
{POLL}
|
||||
{FILEATTACH}
|
||||
|
||||
<tr style='vertical-align:top'>
|
||||
<td colspan='2' style='text-align:center'>
|
||||
{BUTTONS}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<td style='width:20%'>Post Options</td>
|
||||
<td style='width:80%'>
|
||||
{POSTOPTIONS}
|
||||
</td></tr></table>
|
||||
<div class='text-center'>
|
||||
{BUTTONS}
|
||||
</div>
|
||||
{FORMEND}
|
||||
|
||||
</div></div>
|
||||
|
@@ -283,7 +283,7 @@ $FORUM_CRUMB['forum']['value'] = "{FORUM_TITLE}";
|
||||
// <small>{BREADCRUMB}</small> //FIXME Breadcrumb looks crummy
|
||||
|
||||
$FORUM_VIEWFORUM_TEMPLATE['start'] = "";
|
||||
$FORUM_VIEWFORUM_TEMPLATE['header'] = "<div class='row'><div class='span9 pull-left'><h3>{FORUMTITLE}</h3></div><div class='span3 pull-right right' style='padding-top:10px'>{NEWTHREADBUTTONX}</div></div>
|
||||
$FORUM_VIEWFORUM_TEMPLATE['header'] = "<div class='row-fluid'><div class='span9 pull-left'><h3>{FORUMTITLE}</h3></div><div class='span3 pull-right right' style='padding-top:10px'>{NEWTHREADBUTTONX}</div></div>
|
||||
<table class='table table-hover table-striped'>
|
||||
<colgroup>
|
||||
<col style='width:3%' />
|
||||
|
@@ -2,13 +2,10 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@@ -310,11 +307,11 @@ $FORUM_CRUMB['forum']['value'] = "<a class='forumlink' href='{FORUM_HREF}'>{FORU
|
||||
|
||||
$FORUM_VIEWTOPIC_TEMPLATE['start'] = "
|
||||
|
||||
<div class='row'>
|
||||
<div class='row-fluid'>
|
||||
<div class='span6 pull-left'>{BACKLINK}</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='row-fluid'>
|
||||
<div class='span9 pull-left'><h3>{THREADNAME}</h3></div><div class='span3 pull-right right' style='padding-top:10px'>{BUTTONSX}</div>
|
||||
</div>
|
||||
|
||||
|
@@ -378,6 +378,23 @@ class poll
|
||||
require(e_PLUGIN.'poll/templates/poll_template.php');
|
||||
}
|
||||
|
||||
if($type == 'forum' && e_BOOTSTRAP === true)
|
||||
{
|
||||
|
||||
require_once(e_PLUGIN."forum/templates/forum_poll_template.php");
|
||||
|
||||
$POLL_FORUM_NOTVOTED_START = $FORUM_POLL_TEMPLATE['form']['start'];
|
||||
$POLL_FORUM_NOTVOTED_LOOP = $FORUM_POLL_TEMPLATE['form']['item'];
|
||||
$POLL_FORUM_NOTVOTED_END = $FORUM_POLL_TEMPLATE['form']['end'];
|
||||
|
||||
$POLL_FORUM_VOTED_START = $FORUM_POLL_TEMPLATE['results']['start'];
|
||||
$POLL_FORUM_VOTED_LOOP = $FORUM_POLL_TEMPLATE['results']['item'];
|
||||
$POLL_FORUM_VOTED_END = $FORUM_POLL_TEMPLATE['results']['end'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$preview = FALSE;
|
||||
if ($type == 'preview')
|
||||
{
|
||||
@@ -394,39 +411,61 @@ class poll
|
||||
$comment_total = $sql->db_Count("comments", "(*)", "WHERE `comment_item_id`='".intval($pollArray['poll_id'])."' AND `comment_type`=4");
|
||||
}
|
||||
|
||||
$QUESTION = $tp -> toHTML($pollArray['poll_title'], TRUE, "emotes_off, defs");
|
||||
$VOTE_TOTAL = POLLAN_31.": ".$voteTotal;
|
||||
$COMMENTS = ($pollArray['poll_comment'] ? " <a href='".e_BASE."comment.php?comment.poll.".$pollArray['poll_id']."'>".POLLAN_27.": ".$comment_total."</a>" : "");
|
||||
$poll_count = $sql->db_Count("polls", "(*)", "WHERE poll_id <= '".$pollArray['poll_id']."'");
|
||||
$sc = e107::getScBatch('poll');
|
||||
$sc->setVars($pollArray);
|
||||
|
||||
|
||||
|
||||
$QUESTION = $tp -> toHTML($pollArray['poll_title'], TRUE, "emotes_off, defs");
|
||||
|
||||
|
||||
$VOTE_TOTAL = POLLAN_31.": ".$voteTotal;
|
||||
$COMMENTS = ($pollArray['poll_comment'] ? " <a href='".e_BASE."comment.php?comment.poll.".$pollArray['poll_id']."'>".POLLAN_27.": ".$comment_total."</a>" : "");
|
||||
|
||||
|
||||
$poll_count = $sql->db_Count("polls", "(*)", "WHERE poll_id <= '".$pollArray['poll_id']."'");
|
||||
$OLDPOLLS = '';
|
||||
|
||||
if ($poll_count > 1)
|
||||
{
|
||||
$OLDPOLLS = ($type == 'menu' ? "<a href='".e_PLUGIN_ABS."poll/oldpolls.php'>".POLLAN_28."</a>" : "");
|
||||
}
|
||||
$AUTHOR = POLLAN_35." ".($type == 'preview' || $type == 'forum' ? USERNAME : "<a href='".e_BASE."user.php?id.".$pollArray['poll_admin_id']."'>".$pollArray['user_name']."</a>");
|
||||
|
||||
$AUTHOR = POLLAN_35." ".($type == 'preview' || $type == 'forum' ? USERNAME : "<a href='".e_BASE."user.php?id.".$pollArray['poll_admin_id']."'>".$pollArray['user_name']."</a>");
|
||||
|
||||
|
||||
|
||||
|
||||
switch ($POLLMODE)
|
||||
{
|
||||
case 'notvoted':
|
||||
$text = "<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>\n".preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_NOTVOTED_START : $POLL_NOTVOTED_START));
|
||||
$count = 1;
|
||||
$sc->answerCount = 1;
|
||||
$alt = 0; // alternate style.
|
||||
|
||||
$template = ($type == "forum") ? $POLL_FORUM_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP;
|
||||
|
||||
foreach ($optionArray as $option)
|
||||
{
|
||||
$sc->answerOption = $option;
|
||||
// $MODE = ($mode) ? $mode : ""; /* debug */
|
||||
$OPTIONBUTTON = ($pollArray['poll_allow_multiple'] ? "<input type='checkbox' name='votea[]' value='$count' />" : "<input type='radio' name='votea' value='$count' />");
|
||||
$OPTION = $tp->toHTML($option, TRUE);
|
||||
if (isset($POLL_NOTVOTED_LOOP_ALT) && $POLL_NOTVOTED_LOOP_ALT && $type != "forum")
|
||||
{ // alternating style
|
||||
$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($alt == 0 ? $POLL_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP_ALT));
|
||||
$alt = ($alt ==0) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP));
|
||||
}
|
||||
// $OPTIONBUTTON = ($pollArray['poll_allow_multiple'] ? "<input type='checkbox' name='votea[]' value='$count' />" : "<input type='radio' name='votea' value='$count' />");
|
||||
// $OPTION = $tp->toHTML($option, TRUE);
|
||||
|
||||
// $OPTIONBUTTON = $tp->parseTemplate("{OPTIONBUTTON}",true);
|
||||
|
||||
// $OPTION = $tp->parseTemplate("{OPTION}",true);
|
||||
|
||||
// $OPTION = $tp->parseTemplate("{ANSWER}",true);
|
||||
|
||||
$text .= $tp->parseTemplate($template, true);
|
||||
|
||||
$count ++;
|
||||
$sc->answerCount++;
|
||||
}
|
||||
|
||||
|
||||
$SUBMITBUTTON = "<input class='button btn' type='submit' name='pollvote' value='".POLLAN_30."' />";
|
||||
if (('preview' == $type || $preview == TRUE) && strpos(e_SELF, "viewtopic") === FALSE)
|
||||
{
|
||||
@@ -486,13 +525,15 @@ class poll
|
||||
}
|
||||
|
||||
if (!defined("POLLRENDERED")) define("POLLRENDERED", TRUE);
|
||||
|
||||
$caption = (file_exists(THEME."images/poll_menu.png") ? "<img src='".THEME_ABS."images/poll_menu.png' alt='' /> ".POLLAN_MENU_CAPTION : POLLAN_MENU_CAPTION);
|
||||
|
||||
if ($type == 'preview')
|
||||
{
|
||||
$caption = POLLAN_23;
|
||||
$text = "<div style='text-align:center; margin-left: auto; margin-right: auto;'>\n<table style='width:350px' class='fborder'>\n<tr>\n<td>\n$text\n</td></tr></table></div>";
|
||||
}
|
||||
else if ($type == 'forum')
|
||||
elseif ($type == 'forum')
|
||||
{
|
||||
$caption = LAN_4;
|
||||
}
|
||||
@@ -535,11 +576,100 @@ class poll
|
||||
$mode = "admin" :: called from admin_config.php
|
||||
$mode = "forum" :: called from forum_post.php
|
||||
*/
|
||||
/**
|
||||
* Render a Poll creation Form
|
||||
* @param $mode string - admin | forum | front
|
||||
*/
|
||||
function renderPollForm($mode='admin')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
|
||||
|
||||
//XXX New v2.x default for front-end. Currently used by forum-post in bootstrap mode.
|
||||
if ($mode == 'front')
|
||||
{
|
||||
|
||||
|
||||
$text = "
|
||||
|
||||
<div class='alert alert-info'>
|
||||
<small >".LAN_386."</small>
|
||||
</div>
|
||||
|
||||
<div class='control-group'>
|
||||
<div>
|
||||
<input class='tbox input-xxlarge' placeholder=\"Poll Question\" type='text' name='poll_title' size='70' value='".$tp->post_toForm(vartrue($_POST['poll_title']))."' maxlength='200' />
|
||||
</div>";
|
||||
|
||||
$option_count = vartrue($_POST['poll_option']) ? count($_POST['poll_option']) : 2;
|
||||
$text .= "
|
||||
<div id='pollsection'>";
|
||||
|
||||
for($count = 1; $count <= $option_count; $count++)
|
||||
{
|
||||
if ($count != 1 && $_POST['poll_option'][($count-1)] =="")
|
||||
{
|
||||
// break;
|
||||
}
|
||||
$opt = ($count==1) ? "id='pollopt' class='btn-group input-append' " : "";
|
||||
$text .="<span {$opt}><input placeholder=\"Poll Answer\" class='tbox' type='text' name='poll_option[]' size='40' value=\"".$_POST['poll_option'][($count-1)]."\" maxlength='200' />";
|
||||
$text .= "</span><br />";
|
||||
}
|
||||
|
||||
$text .="</div>
|
||||
<div class='control-group'>
|
||||
<input class='btn' type='button' name='addoption' value='".LAN_6."' onclick=\"duplicateHTML('pollopt','pollsection')\" /><br />
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
//FIXME - get this looking good with Bootstrap CSS only.
|
||||
|
||||
$opts = array(1=> "yes", 0=> "no");
|
||||
|
||||
// Set to IP address.. Can add a pref to Poll admin for 'default front-end storage method' if demand is there for it.
|
||||
|
||||
$text .= "
|
||||
<div class='form-horizontal control-group'>
|
||||
<label class='control-label'>".POLL_506."</label>
|
||||
<div class='controls'>
|
||||
". $frm->radio('multipleChoice',$opts, vartrue($_POST['multipleChoice'], 0) ).$frm->hidden('storageMethod',1)."
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
/*
|
||||
$text .= "
|
||||
<div class='controls controls-row'>".POLL_506."
|
||||
|
||||
<input type='radio' name='multi/pleChoice' value='1'".(vartrue($_POST['multipleChoice']) ? " checked='checked'" : "")." /> ".POLL_507."
|
||||
<input type='radio' name='multi/pleChoice' value='0'".(!$_POST['multipleChoice'] ? " checked='checked'" : "")." /> ".POLL_508."
|
||||
|
||||
</div>";
|
||||
*/
|
||||
|
||||
//XXX Should NOT be decided by USER
|
||||
/*
|
||||
$text .= "
|
||||
|
||||
<div>
|
||||
".POLLAN_16."
|
||||
|
||||
<input type='radio' name='storageMethod' value='0'".(!vartrue($_POST['storageMethod']) ? " checked='checked'" : "")." /> ".POLLAN_17."<br />
|
||||
<input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] == 1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br />
|
||||
<input type='radio' name='storageMethod' value='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19."
|
||||
</div>
|
||||
";
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//TODO Hardcoded FORUM code needs to be moved somewhere.
|
||||
if ($mode == 'forum')
|
||||
{
|
||||
@@ -706,17 +836,63 @@ class poll
|
||||
}
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
<!--
|
||||
function setcook(pollid){
|
||||
var name = "poll_"+pollid;
|
||||
var date = new Date();
|
||||
var value = pollid;
|
||||
date.setTime(date.getTime()+(365*24*60*60*1000));
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
document.cookie = name+"="+value+expires+"; path=/";
|
||||
|
||||
|
||||
|
||||
class poll_shortcodes extends e_shortcode
|
||||
{
|
||||
var $answerOption = array();
|
||||
var $answerCount;
|
||||
|
||||
function sc_option($parm='')
|
||||
{
|
||||
return $this->answerOption;
|
||||
}
|
||||
|
||||
|
||||
function sc_optionbutton($parm='')
|
||||
{
|
||||
return ($this->var['poll_allow_multiple'] ? "<input type='checkbox' name='votea[]' value='$count' />" : "<input type='radio' name='votea' value='".$this->answerCount."' />");
|
||||
}
|
||||
|
||||
function sc_question($parm = "")
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return $tp -> toHTML($this->var['poll_title'], TRUE, "emotes_off, defs");
|
||||
}
|
||||
|
||||
function sc_answer($parm='')
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
$opt = array('label'=> $this->answerOption);
|
||||
return $frm->radio('votea', $this->answerCount,false, $opt);
|
||||
// $this->answerOption
|
||||
}
|
||||
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e107::js('inline', '
|
||||
|
||||
function setcook(pollid){
|
||||
var name = "poll_"+pollid;
|
||||
var date = new Date();
|
||||
var value = pollid;
|
||||
date.setTime(date.getTime()+(365*24*60*60*1000));
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
document.cookie = name+"="+value+expires+"; path=/";
|
||||
}
|
||||
');
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user