Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Poll input class for Form Builder
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 10 Jan 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -48,33 +48,26 @@ class _Poll extends FormAbstract
|
||||
public function html()
|
||||
{
|
||||
$json = array();
|
||||
|
||||
for( $i = 1; $i <= \IPS\Settings::i()->max_poll_questions; $i++ )
|
||||
|
||||
if ( $this->value AND is_array( $this->value->choices ) AND count( $this->value->choices ) )
|
||||
{
|
||||
$thisQuestion = array();
|
||||
|
||||
if( $this->value AND isset( $this->value->choices[ $i ] ) )
|
||||
foreach ( $this->value->choices as $k => $choice )
|
||||
{
|
||||
$thisQuestion['title'] = $this->value->choices[ $i ]['question'];
|
||||
$thisQuestion['multiChoice'] = (bool) $this->value->choices[ $i ]['multi'];
|
||||
$thisQuestion['choices'] = array();
|
||||
$thisQuestion['title'] = $choice['question'];
|
||||
$thisQuestion['multiChoice'] = ( isset( $choice['multi'] ) and $choice['multi'] ) ? TRUE : FALSE;
|
||||
|
||||
for( $j = 1; $j <= \IPS\Settings::i()->max_poll_choices; $j++ )
|
||||
$thisQuestion['choices'] = array();
|
||||
foreach ( $choice['choice'] as $i => $question )
|
||||
{
|
||||
$thisChoice = array();
|
||||
|
||||
if( $this->value AND isset( $this->value->choices[ $i ]['choice'][ $j ] ) )
|
||||
{
|
||||
$thisChoice['title'] = $this->value->choices[ $i ]['choice'][ $j ];
|
||||
$thisChoice['count'] = $this->value->choices[ $i ]['votes'][ $j ];
|
||||
$thisQuestion['choices'][] = $thisChoice;
|
||||
}
|
||||
$thisChoice['title'] = $question;
|
||||
$thisChoice['count'] = isset( $choice['votes'][ $i ] ) ? $choice['votes'][ $i ] : 0;
|
||||
$thisQuestion['choices'][ $i ] = $thisChoice;
|
||||
}
|
||||
|
||||
$json[] = $thisQuestion;
|
||||
$json[ $k ] = $thisQuestion;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$json = json_encode( $json );
|
||||
|
||||
if( !$this->jsSent )
|
||||
@@ -113,11 +106,16 @@ EOF;
|
||||
$poll = new \IPS\Poll;
|
||||
$poll->starter_id = \IPS\Member::loggedIn()->member_id;
|
||||
}
|
||||
|
||||
|
||||
/* Set values */
|
||||
$data = parent::getValue();
|
||||
if ( !isset( $data['questions'] ) )
|
||||
{
|
||||
if ( isset( $data['fallback'] ) )
|
||||
{
|
||||
return $this->defaultValue;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
$poll->setDataFromForm( $data, $this->options['allowPollOnly'] );
|
||||
@@ -129,7 +127,7 @@ EOF;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Return */
|
||||
return $poll;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user