function getPageHeader() { global $wgLang, $wgContLang; $link = ""; if ( $this->pid !== null ) { $pollStore = new qp_PollStore( array( 'from' => 'pid', 'pid' => $this->pid ) ); if ( $pollStore->pid !== null ) { $pollStore->loadQuestions(); $poll_title = Title::makeTitle( intval( $this->ns ), $this->title, qp_AbstractPoll::s_getPollTitleFragment( $this->poll_id, '' ) ); $pagename = qp_Setup::specialchars( $wgContLang->convert( $poll_title->getPrefixedText() ) ); $pollname = qp_Setup::specialchars( $this->poll_id ); $head = array(); $head[] = $this->showPollActionsList( $pollStore->pid, $pollStore->mPollId, $poll_title ); $head[] = wfMsg( 'qp_header_line_qpul', wfMsg( 'qp_users_link' ), $pagename, $pollname ); $ques_found = false; foreach ( $pollStore->Questions as $qdata ) { if ( $qdata->question_id == $this->question_id ) { $ques_found = true; break; } } if ( $ques_found ) { $qpa = wfMsg( 'qp_header_line_qucl', $this->question_id, qp_Setup::entities( $qdata->CommonQuestion ) ); if ( array_key_exists( $this->cat_id, $qdata->Categories ) ) { $categ = &$qdata->Categories[ $this->cat_id ]; $proptext = $qdata->ProposalText[ $this->proposal_id ]; $cat_name = $categ['name']; if ( array_key_exists( 'spanId', $categ ) ) { $cat_name = wfMsg( 'qp_full_category_name', $cat_name, $qdata->CategorySpans[ $categ['spanId'] ]['name'] ); } $head[] = wfMsg( 'qp_header_line_qucl', $this->question_id, qp_Setup::entities( $qdata->CommonQuestion ), qp_Setup::entities( $proptext ), qp_Setup::entities( $cat_name ) ); qp_Renderer::applyAttrsToRow( $head, array( '__tag' => 'li', '__end' => "\n" ) ); $head = array( '__tag' => 'ul', 'class' => 'head', $head ); $link = PollResults::getPollsLink() . PollResults::getUsersLink() . qp_Renderer::renderTagArray( $head ); } } } } return $link; }
function statsToXls( qp_PollStore $pollStore ) { $pollStore->loadQuestions(); $pollStore->loadTotals(); $pollStore->calculateStatistics(); $first_question = true; foreach ( $pollStore->Questions as $qkey => $qdata ) { $xlsq = ( $qdata->type === 'textQuestion' ) ? $this->text_writer : $this->tabular_writer; $xlsq->setQuestionData( $qdata ); if ( $first_question ) { $this->writeHeader( $pollStore->totalUsersAnsweredQuestion( $qdata ) ); $first_question = false; } $xlsq->writeHeader(); $percentsTable = array(); $spansUsed = count( $qdata->CategorySpans ) > 0 || $qdata->type == "multipleChoice"; $xlsq->writeQuestionStats(); } }