示例#1
0
 public function __construct()
 {
     parent::__construct();
     // Get component parameters
     $this->params = getKunenaImporterParams();
     $this->getPath();
     if (!$this->detectComponent()) {
         return;
     }
     $this->ext_database = $this->getDatabase();
     $this->initialize();
 }
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = getKunenaImporterParams();
     $importer = $this->getModel('import');
     $extforum = $params->get('extforum');
     $exporter = $this->getModel($extforum ? 'export_' . $extforum : 'export');
     $this->pane = JPane::getInstance('sliders');
     $this->assign('title', $exporter->exttitle);
     if ($exporter->external) {
         if (version_compare(JVERSION, '1.6', '>')) {
             jimport('joomla.form.form');
             // Add the search path for the admin component config.xml file.
             JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_kunenaimporter');
             // Get the form.
             $form = JForm::getInstance('com_config.component', 'config', array('control' => 'params', 'load_data' => false), false, '/config');
             // Bind the form to the data.
             if ($form && $params) {
                 $form->bind($params);
             }
             $this->assign('form', $form);
         } else {
             $this->assign('params', $params);
         }
     }
     $this->options = '';
     if (is_object($exporter)) {
         $success = $exporter->detect();
         $errormsg = $exporter->getError();
         if ($success && !$errormsg) {
             $options = $exporter->getExportOptions($importer);
             $this->assign('options', $options);
         }
         $messages = $exporter->getMessages();
         $this->assign('messages', $messages);
     } else {
         $errormsg = 'Exporter not found!';
     }
     $this->assign('errormsg', $errormsg);
     if (!$errormsg) {
         JToolBarHelper::custom('import', 'upload', 'upload', JText::_('Import'), false);
         JToolBarHelper::custom('truncate', 'delete', 'delete', JText::_('Truncate'), false);
         JToolBarHelper::divider();
     }
     if ($exporter->external) {
         JToolBarHelper::save('save', JText::_('Save Settings'));
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = getKunenaImporterParams();
     $importer = $this->getModel('import');
     $exporter = $this->getModel('export_' . $params->get('extforum'));
     $success = $exporter->detect();
     $errormsg = $exporter->getError();
     $messages = $exporter->getMessages();
     if (!$success || $errormsg) {
         $status = 'fail';
         $statusmsg = '???';
         $action = '<a href="' . JRoute::_(COM_KUNENAIMPORTER_BASEURL) . '">Check again</a>';
     } else {
         $status = 'success';
         $statusmsg = 'NONE';
         $action = '<a href="' . JRoute::_(COM_KUNENAIMPORTER_BASEURL . '&view=mapusers') . '">Import</a>';
     }
     if (!$errormsg) {
         $data = $app->getUserState('com_kunenaimporter.MapUsersRes');
         $options[] = array('name' => 'mapusers', 'task' => 'COM_KUNENAIMPORTER_TASK_MAPUSERS', 'desc' => 'COM_KUNENAIMPORTER_DESCRIPTION_MAPUSERS', 'status' => (int) $data['all'], 'total' => (int) $data['total']);
         $this->assign('options', $options);
     }
     $this->assign('params', $params);
     $this->assign('errormsg', $errormsg);
     $this->assign('messages', $messages);
     $this->assign('status', $status);
     $this->assign('statusmsg', $statusmsg);
     $this->assign('action', $action);
     if (!$errormsg) {
         JToolBarHelper::custom('import', 'upload', 'upload', JText::_('Import'), false);
     }
     JToolBarHelper::custom('stopmapping', 'cancel', 'cancel', JText::_('Cancel'), false);
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("setTimeout(\"location='" . JRoute::_(COM_KUNENAIMPORTER_BASEURL . '&task=mapusers') . "'\", 500);");
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = getKunenaImporterParams();
     $importer = $this->getModel('import');
     $exporter = $this->getModel('export_' . $params->get('extforum'));
     $success = $exporter->detect();
     $errormsg = $exporter->getError();
     $messages = $exporter->getMessages();
     if (!$success || $errormsg) {
         $status = 'fail';
         $statusmsg = '???';
         $action = '<a href="' . JRoute::_(COM_KUNENAIMPORTER_BASEURL) . '">Check again</a>';
     } else {
         $status = 'success';
         $statusmsg = 'NONE';
         $action = '<a href="' . JRoute::_(COM_KUNENAIMPORTER_BASEURL . '&view=import') . '">Import</a>';
     }
     if (!$errormsg) {
         $options = $exporter->getExportOptions($importer);
         $this->assign('options', $options);
     }
     $this->assign('params', $params);
     $this->assign('errormsg', $errormsg);
     $this->assign('messages', $messages);
     $this->assign('status', $status);
     $this->assign('statusmsg', $statusmsg);
     $this->assign('action', $action);
     if (!$errormsg) {
         JToolBarHelper::custom('import', 'upload', 'upload', JText::_('Import'), false);
     }
     JToolBarHelper::custom('stopimport', 'cancel', 'cancel', JText::_('Cancel'), false);
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("setTimeout(\"location='" . JRoute::_(COM_KUNENAIMPORTER_BASEURL . '&task=import') . "'\", 500);");
     parent::display($tpl);
 }
 public function display()
 {
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_kunenaimporter/assets/importer.css');
     $document->setTitle(JText::_('Kunena Forum Importer'));
     JToolBarHelper::title(JText::_('Forum Importer'), 'kunenaimporter.png');
     $this->checkDependencies();
     $params = getKunenaImporterParams();
     $forum = $params->get('extforum');
     if (!$forum) {
         $cmd = 'start';
     }
     $cmd = !empty($cmd) ? $cmd : JRequest::getCmd('view', 'default');
     $view = $this->getView($cmd, 'html');
     $component = JComponentHelper::getComponent('com_kunenaimporter');
     // FIXME: J!1.5 code
     $params = new JParameter($component->params);
     $view->setModel($this->getModel('import'), true);
     $extforum = $params->get('extforum');
     $view->setModel($export = $this->getModel($extforum ? 'export_' . $extforum : 'export'), false);
     if ($cmd != 'start') {
         JSubMenuHelper::addEntry(JText::_('Choose Your Software'), 'index.php?option=com_kunenaimporter&view=start', $cmd == 'default');
         JSubMenuHelper::addEntry(JText::_('Importer Configuration'), 'index.php?option=com_kunenaimporter', $cmd == 'default');
         if ($export->external) {
             JSubMenuHelper::addEntry(JText::_('Migrate Users'), 'index.php?option=com_kunenaimporter&view=users', $cmd == 'users');
         }
     }
     $view->display();
 }