public function calculateTrackUsage($surveyId) {
        $select = $this->db->select();
        $select->from('gems__tracks', array('gtr_track_name'));
        $select->joinLeft('gems__rounds', 'gro_id_track = gtr_id_track', array('useCnt' => 'COUNT(*)'))
                ->where('gro_id_survey = ?', $surveyId)
                ->group('gtr_track_name');
        $usage  = $this->db->fetchPairs($select);

        if ($usage) {
            $seq = new \MUtil_Html_Sequence();
            $seq->setGlue(\MUtil_Html::create('br'));
            foreach ($usage as $track => $count) {
                $seq[] = sprintf($this->plural(
                                'Used %d time in %s track.',
                                'Used %d times in %s track.',
                                $count), $count, $track);
            }
            return $seq;
        } else {
            return $this->_('Not used in any track.');
        }
    }
public function calculateTrackUsage($surveyId) {
        $select = $this->db->select();
        $select->from('gems__tracks', array('gtr_track_name'));
        $select->joinLeft('gems__rounds', 'gro_id_track = gtr_id_track', array('useCnt' => 'COUNT(*)'))
                ->where('gro_id_survey = ?', $surveyId)
                ->group('gtr_track_name');
        $usage  = $this->db->fetchPairs($select);

        if ($usage) {
            $seq = new \MUtil_Html_Sequence();
            $seq->setGlue(\MUtil_Html::create('br'));
            foreach ($usage as $track => $count) {
                $seq[] = sprintf($this->plural(
                                'Used %d time in %s track.',
                                'Used %d times in %s track.',
                                $count), $count, $track);
            }
            return $seq;
        } else {
            return $this->_('Not used in any track.');
        }
    }
public function calculateTrackUsage ( $ surveyId ) { $ select = $ this -> db -> select ( ) ; $ select -> from ( 'gems__tracks' , array ( 'gtr_track_name' ) ) ; $ select -> joinLeft ( 'gems__rounds' , 'gro_id_track = gtr_id_track' , array ( 'useCnt' => 'COUNT(*)' ) ) -> where ( 'gro_id_survey = ?' , $ surveyId ) -> group ( 'gtr_track_name' ) ; $ usage = $ this -> db -> fetchPairs ( $ select ) ; if ( $ usage ) { $ seq = new \ MUtil_Html_Sequence ( ) ; $ seq -> setGlue ( \ MUtil_Html :: create ( 'br' ) ) ; foreach ( $ usage as $ track => $ count ) { $ seq [ ] = sprintf ( $ this -> plural ( 'Used %d time in %s track.' , 'Used %d times in %s track.' , $ count ) , $ count , $ track ) ; } return $ seq ; } else { return $ this -> _ ( 'Not used in any track.' ) ; } }
Gets how many times a survey is used in tracks

@param $surveyId int Gems Survey ID
@return array|\MUtil_Html_Sequence translated string with track usage
Gets how many times a survey is used in tracks