Ejemplo n.º 1
0
 protected function _display($supress_output = false)
 {
     $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, '');
     I2CE::raiseError(print_r($this->request(), true));
     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=" . $form;
     } else {
         $form = '';
         if (!$this->request_exists('form') || !($form = $this->request('form')) || !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=" . $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;
 }
 protected function _display($supress_output = false)
 {
     if (!$this->isPost()) {
         //not doing a data import
         return parent::_display($supress_output);
     } else {
         parent::_display($supress_output);
         if ($errors = I2CE_Dumper::cleanlyEndOutputBuffers()) {
             I2CE::raiseError("Errors:\n" . $errors);
         }
         if (!$this->hasPermission('task(form_relationship_can_import)')) {
             $this->pushError("You do not have permission to import");
             return false;
         }
         $ignore_ids = $this->request_exists('ignore_ids') && $this->request('ignore_ids');
         $src = $_FILES['upload']['tmp_name'];
         $this->import($src, $ignore_ids);
         return true;
     }
 }
 protected function _display($supress_output = false)
 {
     if ($this->get_exists('action') && $this->get('action') == 'full_update') {
         parent::_display($supress_output);
         if ($errors = I2CE_Dumper::cleanlyEndOutputBuffers()) {
             I2CE::raiseError("Errors:\n" . $errors);
         }
         return $this->action_full_update_ids();
     }
     $action = false;
     $csd_cache = false;
     $ids = false;
     if (count($this->request_remainder) > 1) {
         reset($this->request_remainder);
         $csd_cache = current($this->request_remainder);
         next($this->request_remainder);
         $action = current($this->request_remainder);
         if (count($this->request_remainder) > 2) {
             next($this->request_remainder);
             $ids = array(current($this->request_remainder));
         }
     }
     if ($action == 'update') {
         if (array_key_exists('HTTP_HOST', $_SERVER)) {
             parent::_display($supress_output);
         }
         if ($errors = I2CE_Dumper::cleanlyEndOutputBuffers()) {
             I2CE::raiseError("Errors:\n" . $errors);
         }
         return $this->action_update_ids($csd_cache, $ids);
     } else {
         if ($action == 'stream') {
             return $this->action_stream($csd_cache, $ids);
         } else {
             if ($action == 'stream_raw') {
                 return $this->action_stream_raw($csd_cache, $ids);
             } else {
                 parent::_display($supress_output);
             }
         }
     }
 }