/** * Show steps */ public function itemsSteps() { $typeid = $this->_jbrequest->get('typeid'); $checkOptions = $this->_jbrequest->get('checkOptions'); $lose = $this->_jbrequest->get('lose'); $key = $this->_jbrequest->get('key'); $create = $this->_jbrequest->get('create'); $createAlias = $this->_jbrequest->get('createAlias', 0); $cleanPrice = $this->_jbrequest->get('cleanPrice', 0); $assign = $this->_jbrequest->getArray('assign'); $appid = (int) $this->_jbrequest->get('appid'); if (empty($appid) || empty($typeid) || !isset($assign[$typeid]) || empty($assign[$typeid])) { $this->app->jbnotify->notice(JText::_('JBZOO_INCORRECT_DATA')); $this->setRedirect($this->app->jbrouter->admin(array('task' => 'index'))); } $data = array('appid' => $appid, 'typeid' => $typeid, 'lose' => $lose, 'key' => $key, 'create' => $create, 'assign' => $assign[$typeid], 'checkOptions' => $checkOptions, 'createAlias' => $createAlias, 'cleanPrice' => $cleanPrice); $this->_jbsession->setBatch($data, 'import'); // save to user params $oldParams = (array) $this->_jbuser->getParam('lastImport-items', array()); $params = $this->_config->getGroup('import.last.items', $oldParams); $params[$typeid] = $assign[$typeid]; unset($data['assign']); $params['previousparams'] = $data; $this->_config->setGroup('import.last.items', $params); $this->renderView(); }
/** * Export dialog action for categoris */ public function categories() { if (!$this->_jbrequest->isPost()) { $this->exportParams = $this->_config->getGroup('export.categories', $this->_jbuser->getParam('export-categories')); $this->_setExportParams(); $this->renderView(); } else { try { $request = $this->app->data->create($this->_jbrequest->getAdminForm()); $data['separator'] = $request->get('separator'); $data['enclosure'] = $request->get('enclosure'); $data['separator'] = empty($data['separator']) ? $this->_defaultParams['separator'] : $data['separator']; $data['enclosure'] = empty($data['enclosure']) ? $this->_defaultParams['enclosure'] : $data['enclosure']; $request->remove('separator'); $request->remove('enclosure'); $this->_config->setGroup('export.categories', $request); $this->_config->setGroup('export', $data); list($appId) = explode(':', $request->get('category_app', '0:')); $files = $this->_jbexport->categoriesToCSV($appId, $request); if (!empty($files)) { $tmpArch = $this->app->jbarch->compress($files, 'jbzoo-export-categories-' . date('Y-m-d_H-i')); } else { throw new AppException(JText::_('JBZOO_EXPORT_CATEGORIES_NOT_FOUND')); } if (is_readable($tmpArch) && JFile::exists($tmpArch)) { $this->app->filesystem->output($tmpArch); JFile::delete($tmpArch); JFolder::delete($this->app->jbpath->sysPath('tmp', '/jbzoo-export')); JExit(); } else { throw new AppException(JText::sprintf('Unable to create file %s', $tmpArch)); } } catch (AppException $e) { $this->app->jbnotify->notice(JText::_('Error create export file') . ' (' . $e . ')'); $this->setRedirect($this->app->jbrouter->admin(array('task' => 'categories'))); } } }