Example #1
0
 public function export_variation()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $name = $app->input->getString('variation', '');
     $folder = $app->input->getString('folder', '');
     if ($file = $model->prepareExport_Variation($name, $folder)) {
         $file = JCckDevHelper::getRelativePath($file, false);
         $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
     } else {
         $this->setRedirect('index.php?option=com_cck&view=variations');
     }
 }
Example #2
0
 public function export()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $recordId = $app->input->getInt('id', 0);
     $elements = $app->input->getString('elements', '');
     $elements = array_flip(explode(',', $elements));
     $dependencies = array();
     $menu = $app->input->getInt('dep_menu', 0);
     $options = $app->input->get('options', array(), 'array');
     if ($app->input->getInt('dep_categories', 0)) {
         $dependencies['categories'] = 1;
     }
     if ($menu) {
         $dependencies['menu'] = $menu;
     }
     if ($file = $model->prepareExport($recordId, $elements, $dependencies, $options)) {
         $file = JCckDevHelper::getRelativePath($file, false);
         $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
     } else {
         $this->setRedirect(_C0_LINK, JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
     }
 }
Example #3
0
 public function process()
 {
     // JSession::checkToken() or jexit( JText::_( 'JINVALID_TOKEN' ) );
     if (!is_file(JPATH_ADMINISTRATOR . '/components/com_cck_toolbox/models/cck_toolbox.php')) {
         $this->setRedirect($this->_getReturnPage(), JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
         return;
     }
     $app = JFactory::getApplication();
     $ids = $app->input->get('cid', array(), 'array');
     $task_id = $app->input->getInt('tid', 0);
     jimport('joomla.utilities.arrayhelper');
     JArrayHelper::toInteger($ids);
     require_once JPATH_ADMINISTRATOR . '/components/com_cck_toolbox/models/cck_toolbox.php';
     $model = JModelLegacy::getInstance('CCK_Toolbox', 'CCK_ToolboxModel');
     $params = JComponentHelper::getParams('com_cck_toolbox');
     $output = 1;
     // $params->get( 'output', 0 );
     if ($file = $model->prepareProcess($params, $task_id, $ids)) {
         if ($output > 0) {
             $this->setRedirect($this->_getReturnPage(), JText::_('COM_CCK_SUCCESSFULLY_PROCESSED'), 'message');
         } else {
             $file = JCckDevHelper::getRelativePath($file, false);
             $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
         }
     } else {
         $this->setRedirect($this->_getReturnPage(), JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
     }
 }
 public function export()
 {
     $app = JFactory::getApplication();
     $type = $app->input->getString('extension', 'plugin');
     $model = $this->getModel();
     if ($type == 'languages') {
         $lang_tag = $app->input->getString('lang_tag', 'en-GB');
         if ($file = $model->prepareLanguages($lang_tag)) {
             $file = JCckDevHelper::getRelativePath($file, false);
             $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
         }
     } else {
         $id = $app->input->getInt('extension_id', 0);
         if ($file = $model->prepareExport($id)) {
             $file = JCckDevHelper::getRelativePath($file, false);
             $this->setRedirect(JUri::base() . 'index.php?option=com_cck&task=download&file=' . $file);
         } else {
             switch ($type) {
                 case 'plugin':
                 default:
                     $link = 'index.php?option=com_' . $type . 's&view=' . $type . '&layout=edit&extension_id=' . $id;
                     break;
             }
             $this->setRedirect($link, 'Plugin not found. Try to download it manually.', 'notice');
         }
     }
 }