Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
+19
-2
@@ -38,6 +38,16 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
*/
|
||||
protected static $multitons;
|
||||
|
||||
/**
|
||||
* @brief Display template
|
||||
*/
|
||||
public $displayTemplate;
|
||||
|
||||
/**
|
||||
* @brief URL to use instead of \IPS\Request::i()->url()
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* Set Default Values
|
||||
*
|
||||
@@ -322,11 +332,18 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
}
|
||||
}
|
||||
|
||||
$output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->poll( $this, \IPS\Request::i()->url() );
|
||||
if ( ! $this->displayTemplate )
|
||||
{
|
||||
$this->displayTemplate = array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' ), 'poll' );
|
||||
}
|
||||
|
||||
$output = call_user_func( $this->displayTemplate, $this, ( $this->url ?: \IPS\Request::i()->url() ) );
|
||||
|
||||
if( \IPS\Request::i()->isAjax() && \IPS\Request::i()->fetchPoll )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( $output, 200, 'text/html' );
|
||||
/* If a vote was submitted but we're returning HTML, that means there was an error (probably a choice not selected for
|
||||
a question) so we return a 500 error code to make the form submit properly rather than showing "Your vote has been saved" */
|
||||
\IPS\Output::i()->sendOutput( $output, ( $this->buildForm() and ! isset( \IPS\Request::i()->viewResults ) ) ? 500 : 200, 'text/html' );
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
Reference in new issue
Block a user