public function mapToJSON(){
        $returnValue = null;

        $mapping = $this->getMapping();
        if(count($mapping)){
            $returnValue = Array();
            $returnValue['identifier'] = $this->getIdentifier();
            $returnValue['defaultValue'] = $this->mappingDefaultValue;
            if($this->hasAttribute('areaMapping')){
                $returnValue = array_merge($returnValue, $this->getAttributeValue('areaMapping'));
            }
            $mappingValue = Array();

            // If a mapping has been defined
            if(!empty($mapping)){
                foreach($mapping as $mapKey => $mappedValue){
                    $mapEntryJSON = Array();
                    $mapEntryJSON['value'] = (float) $mappedValue;
                    $mapEntryJSON['key'] = taoQTI_models_classes_Matching_VariableFactory::createJSONValueFromQTIData($mapKey, $this->getAttributeValue('baseType'));
                    array_push($mappingValue, (object) $mapEntryJSON);
                }

                $returnValue['value'] = $mappingValue;
            }

            $returnValue = (object) $returnValue;
        }

        return $returnValue;
    }
public function mapToJSON(){
        $returnValue = null;

        $mapping = $this->getMapping();
        if(count($mapping)){
            $returnValue = Array();
            $returnValue['identifier'] = $this->getIdentifier();
            $returnValue['defaultValue'] = $this->mappingDefaultValue;
            if($this->hasAttribute('areaMapping')){
                $returnValue = array_merge($returnValue, $this->getAttributeValue('areaMapping'));
            }
            $mappingValue = Array();

            // If a mapping has been defined
            if(!empty($mapping)){
                foreach($mapping as $mapKey => $mappedValue){
                    $mapEntryJSON = Array();
                    $mapEntryJSON['value'] = (float) $mappedValue;
                    $mapEntryJSON['key'] = taoQTI_models_classes_Matching_VariableFactory::createJSONValueFromQTIData($mapKey, $this->getAttributeValue('baseType'));
                    array_push($mappingValue, (object) $mapEntryJSON);
                }

                $returnValue['value'] = $mappingValue;
            }

            $returnValue = (object) $returnValue;
        }

        return $returnValue;
    }
public function mapToJSON ( ) { $ returnValue = null ; $ mapping = $ this -> getMapping ( ) ; if ( count ( $ mapping ) ) { $ returnValue = Array ( ) ; $ returnValue [ 'identifier' ] = $ this -> getIdentifier ( ) ; $ returnValue [ 'defaultValue' ] = $ this -> mappingDefaultValue ; if ( $ this -> hasAttribute ( 'areaMapping' ) ) { $ returnValue = array_merge ( $ returnValue , $ this -> getAttributeValue ( 'areaMapping' ) ) ; } $ mappingValue = Array ( ) ; // If a mapping has been defined if ( ! empty ( $ mapping ) ) { foreach ( $ mapping as $ mapKey => $ mappedValue ) { $ mapEntryJSON = Array ( ) ; $ mapEntryJSON [ 'value' ] = ( float ) $ mappedValue ; $ mapEntryJSON [ 'key' ] = taoQTI_models_classes_Matching_VariableFactory :: createJSONValueFromQTIData ( $ mapKey , $ this -> getAttributeValue ( 'baseType' ) ) ; array_push ( $ mappingValue , ( object ) $ mapEntryJSON ) ; } $ returnValue [ 'value' ] = $ mappingValue ; } $ returnValue = ( object ) $ returnValue ; } return $ returnValue ; }
get the mapping in JSON format. If no mapping defined return null.

@deprecated now use the new qtism lib for response evaluation
@access public
@author Joel Bout, <joel.bout@tudor.lu>
get the mapping in JSON format . If no mapping defined return null .