/** * Serialize item object into json format, handy to be used in js */ public function toArray($filterVariableContent = false, &$filtered = array()) { $data = parent::toArray($filterVariableContent, $filtered); $data['namespaces'] = $this->getNamespaces(); $data['stylesheets'] = $this->getArraySerializedElementCollection($this->getStylesheets(), $filterVariableContent, $filtered); $data['outcomes'] = $this->getArraySerializedElementCollection($this->getOutcomes(), $filterVariableContent, $filtered); $data['responses'] = $this->getArraySerializedElementCollection($this->getResponses(), $filterVariableContent, $filtered); $data['feedbacks'] = $this->getArraySerializedElementCollection($this->getModalFeedbacks(), $filterVariableContent, $filtered); $data['responseProcessing'] = $this->responseProcessing->toArray($filterVariableContent, $filtered); return $data; }
/** * Serialize item object into json format, handy to be used in js */ public function toArray($filterVariableContent = false, &$filtered = array()) { $data = parent::toArray($filterVariableContent, $filtered); $data['namespaces'] = $this->getNamespaces(); $data['stylesheets'] = array(); foreach ($this->getStylesheets() as $stylesheet) { $data['stylesheets'][$stylesheet->getSerial()] = $stylesheet->toArray($filterVariableContent, $filtered); } $data['outcomes'] = array(); foreach ($this->getOutcomes() as $outcome) { $data['outcomes'][$outcome->getSerial()] = $outcome->toArray($filterVariableContent, $filtered); } $data['responses'] = array(); foreach ($this->getResponses() as $response) { $data['responses'][$response->getSerial()] = $response->toArray($filterVariableContent, $filtered); } $data['feedbacks'] = array(); foreach ($this->getModalFeedbacks() as $feedback) { $data['feedbacks'][$feedback->getSerial()] = $feedback->toArray($filterVariableContent, $filtered); } $data['responseProcessing'] = $this->responseProcessing->toArray($filterVariableContent, $filtered); return $data; }