public function merge() { require_once 'models/table/EditTable.php'; $params = $this->_getAllParams(); if (!isset($params['mergeto']) && is_array($params['merge'])) { $fields = array_keys($this->fields); $rows = EditTable::getRowsSingle($this->table, $fields, 'id IN(' . implode(',', $params['merge']) . ')'); $html = 'The phrases below will be merged into one. Please select the primary phrase you wish to use:<br><br>'; foreach ($rows as $row) { $html .= '<p><input type="radio" name="mergeto" value="' . $row['id'] . '" id="merge' . $row['id'] . '"><label for="merge' . $row['id'] . '">' . $row[$fields[0]] . '</label></p>'; } $html .= ' <input type="hidden" name="merge" value="' . implode(',', $params['merge']) . '"> <input type="submit" class="submitNoArrow" value="Merge into one" style="float:none;"> '; } elseif (isset($params['mergeto'])) { $mergeids = explode(',', $params['merge']); EditTable::merge($this->table, $this->dependencies[0], $mergeids, $params['mergeto']); header("Location: " . $_SERVER['REQUEST_URI']); } else { $html = 'Unable to merge phrases.'; } $this->controller->view->assign($this->viewVar, $html); }