private function getAnswerHeader( qp_PollStore $pollStore ) { $tags = array( array( '__tag' => 'div', 'style' => 'font-weight:bold;', wfMsg( 'qp_results_submit_attempts', intval( $pollStore->attempts ) ) ) ); $interpTitle = $pollStore->getInterpTitle(); if ( !( $interpTitle instanceof Title ) ) { $tags[] = array( '__tag' => 'div', wfMsg( 'qp_poll_has_no_interpretation' ) ); return $tags; } $interp_link = $this->qpLink( $interpTitle, $interpTitle->getPrefixedText() ); $tags[] = array( '__tag' => 'div', wfMsg( 'qp_browse_to_interpretation', $interp_link ) ); $interpResultView = new qp_InterpResultView( true ); $interpResultView->showInterpResults( $tags, $pollStore->interpResult, true ); return $tags; }
/** * Encloses the output of $this->renderQuestionViews() into the output tag wrappers * @return rendered "final" html */ function renderPoll() { $pollStore = $this->ctrl->pollStore; # Generates the output. $qpoll_div = array( '__tag' => 'div', 'class' => 'qpoll' ); $qpoll_div[] = array( '__tag' => 'a', 'name' => $this->ctrl->getPollTitleFragment( null, '' ), 0 => '' ); # output script-generated error, when available # render short/long/structured result, when permitted and available $interpResultView = qp_InterpResultView::newFromBaseView( $this ); $interpResultView->showInterpResults( $qpoll_div, $pollStore->interpResult ); # unused anymore unset( $interpResultView ); # create voting form and fill it with messages and inputs $qpoll_form = array( '__tag' => 'form', 'method' => 'post', 'action' => $this->ctrl->getPollTitleFragment(), 'autocomplete' => 'off', '__end' => "\n" ); $qpoll_div[] = &$qpoll_form; # Determine the content of the settings table. $settings = Array(); if ( $this->ctrl->mState != '' ) { $settings[0][] = array( '__tag' => 'td', 'class' => 'margin object_error' ); $settings[0][] = array( '__tag' => 'td', 0 => wfMsgHtml( 'qp_result_' . $this->ctrl->mState ) ); } # Build the settings table. if ( count( $settings ) > 0 ) { $settingsTable = array( '__tag' => 'table', 'class' => 'settings', '__end' => "\n" ); foreach ( $settings as $settingsTr ) { $settingsTable[] = array( '__tag' => 'tr', 0 => $settingsTr, '__end' => "\n" ); } $qpoll_form[] = &$settingsTable; } $qpoll_form[] = array( '__tag' => 'input', 'type' => 'hidden', 'name' => 'pollId', 'value' => $this->ctrl->mPollId ); $qpoll_form[] = array( '__tag' => 'div', 'class' => 'pollQuestions', 0 => $this->renderQuestionViews() ); $submitBtn = array( '__tag' => 'input', 'type' => 'submit' ); $submitMsg = 'qp_vote_button'; if ( $pollStore->isAlreadyVoted() ) { $submitMsg = 'qp_vote_again_button'; } if ( $this->ctrl->mBeingCorrected ) { if ( $pollStore->getState() == "complete" ) { $submitMsg = 'qp_vote_again_button'; } } else { if ( $pollStore->getState() == "error" ) { $submitBtn['disabled'] = 'disabled'; } } $atLeft = $this->ctrl->attemptsLeft(); if ( $atLeft === false ) { $submitBtn['disabled'] = 'disabled'; } # disable submit button in preview mode & printable version if ( qp_Setup::$request->getVal( 'action' ) == 'parse' || qp_Setup::$output->isPrintable() ) { $submitBtn['disabled'] = 'disabled'; } $submitBtn['value'] = wfMsgHtml( $submitMsg ); $p = array( '__tag' => 'p' ); $p[] = $submitBtn; # output "no more attempts" message, when applicable if ( $atLeft === false ) { $p[] = array( '__tag' => 'span', 'class' => 'attempts_counter', qp_Setup::specialchars( wfMsg( 'qp_error_no_more_attempts' ) ) ); } elseif ( $atLeft !== true ) { $p[] = array( '__tag' => 'span', 'class' => 'attempts_counter', qp_Setup::specialchars( wfMsgExt( 'qp_submit_attempts_left', array( 'parsemag' ), intval( $atLeft ) ) ) ); } $qpoll_form[] = &$p; return qp_Renderer::renderTagArray( $qpoll_div ); }