Beispiel #1
0
 /**
  * perform the file upload and set the session state
  * Unlike front end import if there are unmatched heading we take the user to
  * a form asking if they want to import those new headings (creating new elements for them)
  * @return null
  */
 function doimport()
 {
     $model =& $this->getModel('Importcsv');
     @set_time_limit(800);
     $tmp_file = $model->checkUpload();
     if ($tmp_file === false) {
         $this->display();
     }
     //$userfile = JRequest::getVar('userfile', null, 'files');
     $model->readCSV($tmp_file);
     $model->findExistingElements();
     $tableModel =& $model->getTableModel();
     $this->table =& $tableModel->getTable();
     $this->newHeadings =& $model->newHeadings;
     $this->headings =& $model->headings;
     $this->data = $model->data;
     $this->matchedHeadings =& $model->matchedHeadings;
     $session =& JFactory::getSession();
     $session->set('com_fabrik.csvheadings', $this->headings);
     $session->set('com_fabrik.csvdata', $this->data);
     $session->set('com_fabrik.matchedHeadings', $this->matchedHeadings);
     if (!empty($model->newHeadings)) {
         $pluginManager =& $this->getModel('pluginmanager');
         $elementTypes = $pluginManager->getElementTypeDd('fabrikfield', 'plugin[]');
         FabrikViewImport::csvChooseElementTypes($elementTypes);
     } else {
         JRequest::setVar('fabrik_table', $this->table->id);
         $msg = $model->makeTableFromCSV();
         $this->setRedirect('index.php?option=com_fabrik&c=table', $msg);
     }
 }