protected function _display($supress_output = false) { if ($this->getAction() != 'remap') { return parent::_display($supress_output); } $this->template->addHeaderLink('mootools-core.js'); $this->template->addHeaderLink('mootools-more.js'); parent::_display($supress_output); if ($errors = I2CE_Dumper::cleanlyEndOutputBuffers()) { I2CE::raiseError("Errors:\n" . $errors); } $this->ff = I2CE_FormFactory::instance(); if (!$this->request_exists('id') || !($formid = $this->request('id'))) { $this->pushError("Bad list id {$id}"); //needs to be localized return false; } $success = true; list($form, $id) = array_pad(explode("|", $formid, 2), 2, ''); if ($id == '*') { $where = array('operator' => 'FIELD_LIMIT', 'field' => 'remap', 'style' => 'not_null', 'data' => array()); $ids = I2CE_FormStorage::search($form, false, $where); I2CE::raiseError("Form {$form} has remapping data for " . implode(" ", $ids)); if (count($ids) > 0) { foreach (I2CE_List::getFieldsMappingToList($form) as $rform => $fields) { foreach ($fields as $fieldObj) { $field = $fieldObj->getName(); foreach ($ids as $id) { I2CE::raiseError("Checking for remaps on {$rform}+{$field}"); $success &= $this->doRemap($rform, $field, $form . '|' . $id); } } } } $url = "index.php/auto_list?form_name=" . $form; } else { $form = ''; if (!$this->request_exists('form_name') || !($form = $this->request('form_name')) || !in_array($form, $this->ff->getForms())) { $this->pushError("Form {$form} not found"); return false; } $field = ''; if (!$this->request_exists('field') || !($field = $this->request('field'))) { $this->pushError("Bad Field {$field}"); return false; } $success = $this->doRemap($form, $field, $formid); $url = "index.php/auto_list?id={$formid}&form_name=" . $form; } if ($success) { $this->pushContent("Data was succesully remapped. Continue on to database lists <a href='{$url}'>site</a>?"); } else { $this->pushContent("Data was <b>not</b> succesully remapped. Continue on to database lists <a href='{$url}'>site</a>?"); } return true; }