Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
+23
-2
@@ -213,7 +213,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
{
|
||||
$choices[ $k ] = array(
|
||||
'question' => $questionData['title'],
|
||||
'multi' => \intval( isset( $questionData['multichoice'] ) ),
|
||||
'multi' => (int) !empty( $questionData['multichoice'] ),
|
||||
'choice' => array(),
|
||||
'votes' => array(),
|
||||
);
|
||||
@@ -588,7 +588,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
foreach ( $this->choices as $k => $data )
|
||||
{
|
||||
$class = ( isset( $data['multi'] ) AND $data['multi'] ) ? 'IPS\Helpers\Form\CheckboxSet' : 'IPS\Helpers\Form\Radio';
|
||||
$input = new $class( $k, ( isset( $data['multi'] ) AND $data['multi'] ) ? array() : NULL, TRUE, array( 'options' => $data['choice'], 'noDefault' => TRUE ) );
|
||||
$input = new $class( $k, ( isset( $data['multi'] ) AND $data['multi'] ) ? array() : NULL, TRUE, array( 'options' => $data['choice'], 'noDefault' => TRUE, 'showAllNone' => FALSE, 'condense' => FALSE ) );
|
||||
|
||||
$input->label = $data['question'];
|
||||
$form->add( $input );
|
||||
@@ -660,6 +660,10 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
* @return array
|
||||
* @apiresponse int id ID number
|
||||
* @apiresponse string title Title
|
||||
* @apiresponse datetime startDate Start Date
|
||||
* @apiresponse bool closed Closed
|
||||
* @apiresponse datetime closedDate Closed Date
|
||||
* @apiresponse bool public Public poll
|
||||
* @apiresponse int votes Number of votes
|
||||
* @apiresponse [\IPS\Poll\Question] questions The questions
|
||||
*/
|
||||
@@ -674,6 +678,10 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
return array(
|
||||
'id' => $this->pid,
|
||||
'title' => $this->poll_question,
|
||||
'startDate' => $this->start_date->rfc3339(),
|
||||
'closed' => (bool) $this->poll_closed,
|
||||
'closedDate' => ( $this->poll_closed ? $this->poll_close_date->rfc3339() : null ),
|
||||
'public' => (bool) $this->poll_view_voters,
|
||||
'votes' => $this->votes,
|
||||
'questions' => $questions
|
||||
);
|
||||
@@ -699,4 +707,17 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
|
||||
$this->author()->achievementAction( 'core', 'NewPoll', $this );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [ActiveRecord] Delete Record
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
parent::delete();
|
||||
|
||||
/* Delete records from voters table */
|
||||
\IPS\Db::i()->delete( 'core_voters', array( 'poll=?', $this->pid ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user