/** * Method to load content data * * @access private * @return boolean True on success * @since 0.9 */ function _loadData() { //Lets load the content if it doesn't already exist if (empty($this->_data)) { // get form id and answer id $query = 'SELECT form_id, answer_id ' . ' FROM #__rwf_submitters AS s ' . ' WHERE id = ' . $this->_id; $this->_db->setQuery($query); list($form_id, $answer_id) = $this->_db->loadRow(); if (!$form_id || !$answer_id) { Jerror::raiseError(0, JText::_('COM_REDEVENT_No_data')); } // get fields $query = 'SELECT id, field FROM #__rwf_fields ' . ' WHERE form_id = ' . $this->_db->Quote($form_id); $this->_db->setQuery($query); $fields = $this->_db->loadObjectList(); // now get the anwsers $query = 'SELECT * FROM #__rwf_forms_' . $form_id . ' WHERE id = ' . $this->_db->Quote($answer_id); $this->_db->setQuery($query); $answers = $this->_db->loadObject(); // add the answers to fields objects foreach ($fields as $k => $f) { $property = 'field_' . $f->id; if (property_exists($answers, $property)) { $fields[$k]->value = $answers->{$property}; } } $this->_data = $fields; if (!$this->_data) { echo $this->_db->getErrorMsg(); } return (bool) $this->_data; } return true; }