load( $uid );
// fail if checked out not by 'me'
if ($poll->isCheckedOut( $user->get('id') )) {
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The poll' ), $poll->title );
$this->setRedirect( 'index.php?option='. $option, $msg );
}
if ($poll->id == 0)
{
// defaults
$row->published = 1;
}
$options = array();
if ($edit)
{
$poll->checkout( $user->get('id') );
$query = 'SELECT id, text'
. ' FROM #__poll_data'
. ' WHERE pollid = '.(int) $uid
. ' ORDER BY id'
;
$db->setQuery($query);
$options = $db->loadObjectList();
}
else
{
$poll->lag = 3600*24;
}
$this->assignRef('poll', $poll);
$this->assignRef('options', $options);
parent::display($tpl);
}
}