public function getCompletedTokens($tokenIds, $sourceSurveyId)
    {
        $lsDb       = $this->getSourceDatabase();
        $lsToken   = $this->_getTokenTableName($sourceSurveyId);

        // Make sure we use tokens in the format LimeSurvey likes
        $tokens = array_map(array($this, '_getToken'), $tokenIds);

        $sql = $lsDb->select()
                ->from($lsToken, array('token'))
                ->where('token IN (?)', $tokens)
                ->where('completed != ?', 'N');

        $completedTokens = $lsDb->fetchCol($sql);

        // Now make sure we return tokens GemsTracker likes
        if ($completedTokens) {
            $translatedTokens = array();

            // Can not use the map function here since we need a second parameter
            foreach($completedTokens as $token) {
                $translatedTokens[] = $this->_getToken($token, true);
            }

            return $translatedTokens;
        }

        return $completedTokens;
    }
public function getCompletedTokens($tokenIds, $sourceSurveyId)
    {
        $lsDb       = $this->getSourceDatabase();
        $lsToken   = $this->_getTokenTableName($sourceSurveyId);

        // Make sure we use tokens in the format LimeSurvey likes
        $tokens = array_map(array($this, '_getToken'), $tokenIds);

        $sql = $lsDb->select()
                ->from($lsToken, array('token'))
                ->where('token IN (?)', $tokens)
                ->where('completed != ?', 'N');

        $completedTokens = $lsDb->fetchCol($sql);

        // Now make sure we return tokens GemsTracker likes
        if ($completedTokens) {
            $translatedTokens = array();

            // Can not use the map function here since we need a second parameter
            foreach($completedTokens as $token) {
                $translatedTokens[] = $this->_getToken($token, true);
            }

            return $translatedTokens;
        }

        return $completedTokens;
    }
public function getCompletedTokens ( $ tokenIds , $ sourceSurveyId ) { $ lsDb = $ this -> getSourceDatabase ( ) ; $ lsToken = $ this -> _getTokenTableName ( $ sourceSurveyId ) ; // Make sure we use tokens in the format LimeSurvey likes $ tokens = array_map ( array ( $ this , '_getToken' ) , $ tokenIds ) ; $ sql = $ lsDb -> select ( ) -> from ( $ lsToken , array ( 'token' ) ) -> where ( 'token IN (?)' , $ tokens ) -> where ( 'completed != ?' , 'N' ) ; $ completedTokens = $ lsDb -> fetchCol ( $ sql ) ; // Now make sure we return tokens GemsTracker likes if ( $ completedTokens ) { $ translatedTokens = array ( ) ; // Can not use the map function here since we need a second parameter foreach ( $ completedTokens as $ token ) { $ translatedTokens [ ] = $ this -> _getToken ( $ token , true ) ; } return $ translatedTokens ; } return $ completedTokens ; }
Bulk check token completion

Returns all tokens from the input array that are completed, by doing
this in bulk we saved overhead and only do a deep check on the completed
tokens.

@param array $tokenIds
@param int $sourceSurveyId
@return array
Bulk check token completion