public function toArray($filterVariableContent = false, &$filtered = array()) { $returnValue = parent::toArray($filterVariableContent, $filtered); $rpSerialized = QtiSerializer::parseResponseProcessingXml(simplexml_load_string($this->data)); $protectedData = array('processingType' => 'custom', 'data' => $this->data, 'responseRules' => $rpSerialized['responseRules']); if ($filterVariableContent) { $filtered[$this->getSerial()] = $protectedData; } else { $returnValue = array_merge($returnValue, $protectedData); } return $returnValue; }
public function toArray($filterVariableContent = false, &$filtered = array()) { $returnValue = parent::toArray($filterVariableContent, $filtered); $rp = null; $template = $this->convertToTemplate(); if (is_null($template)) { //cannot be converted into a Template instance, so build the rp from the current instance $rp = $this->buildQTI(); } else { //can be converted into a Template instance, so get the Template content $rp = $template->getTemplateContent(); } $rpSerialized = QtiSerializer::parseResponseProcessingXml(simplexml_load_string($rp)); $protectedData = array('processingType' => 'templateDriven', 'responseRules' => $rpSerialized['responseRules']); if ($filterVariableContent) { $filtered[$this->getSerial()] = $protectedData; } else { $returnValue = array_merge($returnValue, $protectedData); } return $returnValue; }