Пример #1
0
	private function showStats( $pid ) {
		$output = '';
		if ( $pid !== null ) {
			$pollStore = new qp_PollStore( array( 'from' => 'pid', 'pid' => $pid ) );
			if ( $pollStore->pid !== null ) {
				$pollStore->loadQuestions();
				$pollStore->loadTotals();
				$pollStore->calculateStatistics();
				$head = array( '__tag' => 'div', 'class' => 'head', '__end' => "\n",
					$this->showPollActionsList(
						$pollStore->pid,
						$pollStore->mPollId,
						$pollStore->getTitle()
					)
				);
				$output .= qp_Renderer::renderTagArray( $head );
				$interpTitle = $pollStore->getInterpTitle();
				if ( $interpTitle instanceof Title ) {
					$interp_link = $this->qpLink( $interpTitle, $interpTitle->getPrefixedText() );
					$output .= wfMsg( 'qp_browse_to_interpretation', $interp_link ) . "<br />\n";
				}
				$output .=
					$this->qpLink(
						$this->getTitle(),
						wfMsg( 'qp_export_to_xls' ),
						array( "style" => "font-weight:bold;" ),
						array( 'action' => 'stats_xls', 'id' => $pid )
					) . "<br />\n" .
					$this->qpLink(
						$this->getTitle(),
						wfMsg( 'qp_voices_to_xls' ),
						array( "style" => "font-weight:bold;" ),
						array( 'action' => 'voices_xls', 'id' => $pid )
					) . "<br />\n" .
					$this->qpLink(
						$this->getTitle(),
						wfMsg( 'qp_interpretation_results_to_xls' ),
						array( "style" => "font-weight:bold;" ),
						array( 'action' => 'interpretation_xls', 'id' => $pid )
					) . "<br />\n";
				foreach ( $pollStore->Questions as $qdata ) {
					$qview = $qdata->getView();
					$output .= $qview->displayStats( $this, $pid );
				}
			}
		}
		return $output;
	}
Пример #2
0
	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();
		}
	}