static function cellTemplate2() { # statical styles $percentstyle = ''; if ( isset( self::$showResults['textcolor'] ) ) { $percentstyle = 'color:' . self::$showResults['textcolor'] . ';'; } if ( isset( self::$showResults['textbackground'] ) ) { $percentstyle .= 'background-color:' . self::$showResults['textbackground'] . ';'; } # has one available template ('bar') self::$cellTemplate = array( 'bar' => array( '__tag' => 'div', 'class' => 'stats2', 0 => array( '__tag' => 'div', 'class' => 'bar1', 'style' => &self::$cellTemplateParam['bar1style'], 0 => ' ' ), 1 => array( '__tag' => 'div', 'class' => 'bar2', 'style' => &self::$cellTemplateParam['bar2style'], 0 => ' ' ), 2 => array( '__tag' => 'div', 'class' => 'bar3', 'style' => $percentstyle, 0 => &self::$cellTemplateParam['percents'] ) ), # the following entries are not real templates, but pre-calculated values of css attributes taken from showresults parameter 'bar1showres' => '', 'bar2showres' => '' ); # dynamical styles, width: in percents will be added during rendering in addShowResults if ( isset( self::$showResults['color'] ) ) { self::$cellTemplate['bar1showres'] .= 'background:' . self::$showResults['color'] . ';'; } if ( isset( self::$showResults['background'] ) ) { self::$cellTemplate['bar2showres'] .= 'background:' . self::$showResults['background'] . ';'; } }
/** * populates $this->view with proposal rows */ function statsParseBody() { if ( $this->getState() == 'error' ) { return; } $catRow = $this->parseCategories(); if ( count( $this->mCategorySpans ) > 0 ) { $spansRow = $this->parseCategorySpans(); # if there are multiple spans, "turn on" borders for span and category cells if ( count( $this->mCategorySpans ) > 1 ) { $this->view->categoriesStyle .= 'border:1px solid gray;'; } $this->view->addSpanRow( $spansRow ); } $this->view->addCategoryRow( $catRow ); # set static view state for the future qp_QuestionStatsProposalView instances qp_QuestionStatsProposalView::applyViewState( $this->view ); foreach ( $this->mProposalText as $proposalId => $text ) { $pview = new qp_QuestionStatsProposalView( $proposalId, $this ); $pview->text = $text; foreach ( $this->mCategories as $catId => $catDesc ) { $pview->addNewCategory( $catId ); $pview->resetSpanState(); switch ( $this->mType ) { case 'singleChoice' : # category spans have sense only with single choice proposals # dummy input name / value for renderSpan() $name = $value = ''; $pview->renderSpan( $name, $value, $catDesc ); break; } $pview->setCategorySpan(); $pview->setCat( '' ); } $this->view->addProposal( $proposalId, $pview ); } }