/** * Inline edit show the edited element * * @return string */ public function showResults() { $input = $this->app->input; $listModel = $this->formModel->getListModel(); $listId = $listModel->getId(); $listModel->clearCalculations(); $listModel->doCalculations(); $elementId = $input->getInt('elid'); if ($elementId === 0) { return; } $elementModel = $this->formModel->getElement($elementId, true); if (!$elementModel) { return; } $rowId = $input->get('rowid'); $listModel->setId($listId); // If the inline edit stored a element join we need to reset back the table $listModel->clearTable(); $listModel->getTable(); $data = $listModel->getRow($rowId); // For a change in the element which means its no longer shown in the list due to pre-filter. We may want to remove the row from the list as well? if (!is_object($data)) { $data = new stdClass(); } $key = $input->get('element'); $html = ''; $html .= $elementModel->renderListData($data->{$key}, $data); $listRef = 'list_' . $input->get('listref'); $doCalcs = "\nFabrik.blocks['" . $listRef . "'].updateCals(" . json_encode($listModel->getCalculations()) . ")"; $html .= '<script type="text/javascript">'; $html .= $doCalcs; $html .= "</script>\n"; return $html; }
/** * Find the element associated with a key. * Loose lookup to find join element from any key related to the join (e.g. _id & __params). * Used in csv import/export * * @param FabrikFEModelForm $model Form model * @param string $key Key - full element name or full element name with _id / ___params appended * * @return PlgFabrik_Element|boolean */ public static function findElementFromJoinKeys($model, $key) { // Search on fullname fullname_id and fullname___params $lookups = array($key, substr($key, 0, JString::strlen($key) - 3), substr($key, 0, JString::strlen($key) - 9)); foreach ($lookups as $lookup) { $elementModel = $model->getElement($lookup); if ($elementModel) { return $elementModel; } } return false; }