Ejemplo n.º 1
0
 function display($cachable = false, $urlparams = array())
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if (empty(JFactory::getUser()->id)) {
         $url = JRoute::_("index.php?option=com_j2store&view=downloads");
         $redirect = "index.php?option=com_users&view=login&return=" . base64_encode($url);
         $redirect = JRoute::_($redirect, false);
         JFactory::getApplication()->redirect($redirect);
         return;
     }
     $params = JComponentHelper::getParams('com_j2store');
     $model = $this->getModel('downloads');
     $ns = 'com_j2store.downloads';
     $files = $model->getItems();
     $registry = new JRegistry();
     $registry->loadArray($files);
     $files = $registry->toObject();
     //print_r($files);
     //exit;
     //$freefiles=$model->getFreeFiles();
     //$files=$this->process($files,$freefiles);
     $view = $this->getView('downloads', 'html');
     $view->set('_controller', 'downloads');
     $view->set('_view', 'downloads');
     $view->set('_doTask', true);
     $view->set('hidemenu', false);
     $view->setModel($model, true);
     $view->assign('files', $files);
     $view->assign('params', $params);
     $view->setLayout('default');
     //	$view->display();
     parent::display();
 }
Ejemplo n.º 2
0
 /**
  * Method to show a j2store view
  *
  * @access	public
  * @since	1.5
  */
 function display()
 {
     // Set a default view if none exists
     if (!JRequest::getCmd('view')) {
         JRequest::setVar('view', 'mycart');
     }
     parent::display(true);
 }
Ejemplo n.º 3
0
 /**
  * display task
  *
  * @return void
  */
 function display($cachable = false, $urlparams = array())
 {
     // set default view if not set
     $app = JFactory::getApplication();
     $app->input->set('view', $app->input->getWord('view', 'cpanel'));
     // call parent behavior
     parent::display($cachable, $urlparams);
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * Method to (non-PHPdoc)
  * @see J2StoreController::display()
  */
 function display($cachable = false, $urlparams = array())
 {
     $task = $this->getTask();
     if ($task == 'edit' || $task == 'add') {
         JRequest::setVar('hidemainmenu', 1);
         JRequest::setVar('layout', 'edit');
         JRequest::setVar('view', 'layout');
         JRequest::setVar('edit', true);
         $model = $this->getModel('layout');
     }
     parent::display();
 }
Ejemplo n.º 5
0
 function display($cachable = false, $urlparams = array())
 {
     switch ($this->getTask()) {
         case 'edit':
             JRequest::setVar('hidemainmenu', 1);
             JRequest::setVar('layout', 'form');
             JRequest::setVar('view', 'address');
             JRequest::setVar('edit', true);
             $model = $this->getModel('address');
             break;
     }
     parent::display();
 }
Ejemplo n.º 6
0
 function display($cachable = false, $urlparams = array())
 {
     switch ($this->getTask()) {
         case 'add':
             JRequest::setVar('hidemainmenu', 1);
             JRequest::setVar('layout', 'edit');
             JRequest::setVar('view', 'option');
             JRequest::setVar('edit', false);
             break;
         case 'edit':
             JRequest::setVar('hidemainmenu', 1);
             JRequest::setVar('layout', 'edit');
             JRequest::setVar('view', 'option');
             JRequest::setVar('edit', true);
             break;
     }
     parent::display();
 }
Ejemplo n.º 7
0
 function display($cachable = false, $urlparams = array())
 {
     $app = JFactory::getApplication();
     switch ($this->getTask()) {
         case 'add':
             $app->input->set('hidemainmenu', 1);
             $app->input->set('layout', 'edit');
             $app->input->set('view', 'coupon');
             $app->input->set('edit', false);
             break;
         case 'edit':
             $app->input->set('hidemainmenu', 1);
             $app->input->set('layout', 'edit');
             $app->input->set('view', 'coupon');
             $app->input->set('edit', true);
             break;
     }
     parent::display();
 }
Ejemplo n.º 8
0
 function __construct()
 {
     parent::__construct();
     JFactory::getDocument()->setCharset('utf-8');
     JResponse::setHeader('X-Cache-Control', 'False', true);
     $this->params = JComponentHelper::getParams($this->option);
     //	$this->defaultShippingMethod = J2StoreHelperCart::getStoreAddress()->config_shipping_default;
     // create the order object
     $this->_order = JTable::getInstance('Orders', 'Table');
     //initialise tax class
     $this->tax = new J2StoreTax();
     //initialise the session object
     $this->session = JFactory::getSession();
     //language
     $language = JFactory::getLanguage();
     /* Set the base directory for the language */
     $base_dir = JPATH_SITE;
     /* Load the language. IMPORTANT Becase we use ajax to load cart */
     $language->load('com_j2store', $base_dir, $language->getTag(), true);
 }
Ejemplo n.º 9
0
 function display($cachable = false, $urlparams = array())
 {
     $app = JFactory::getApplication();
     switch ($this->getTask()) {
         case 'add':
             $msg = JText::_('J2STORE_AVAILABLE_IN_PRO_VERSION');
             $link = 'index.php?option=com_j2store&view=fields';
             $this->setRedirect($link, $msg);
             break;
         case 'edit':
             $field_id = $app->input->getInt('field_id');
             if (empty($field_id)) {
                 $msg = JText::_('J2STORE_AVAILABLE_IN_PRO_VERSION');
                 $link = 'index.php?option=com_j2store&view=fields';
                 $this->setRedirect($link, $msg);
             }
             $app->input->set('hidemainmenu', 1);
             $app->input->set('layout', 'edit');
             $app->input->set('view', 'field');
             $app->input->set('edit', true);
             break;
     }
     parent::display($cachable = false, $urlparams = array());
 }
Ejemplo n.º 10
0
 /**
  * constructor
  */
 function __construct()
 {
     parent::__construct();
     $this->set('suffix', 'payment');
 }
Ejemplo n.º 11
0
 function __construct()
 {
     parent::__construct();
     $this->registerTask('unsetDefault', 'setDefault');
     $this->registerTask('setDefault', 'setDefault');
 }
Ejemplo n.º 12
0
 /**
  * Overrides the delete method, to include the custom models and tables.
  */
 public function delete()
 {
     $this->includeCustomModel('ShippingRates');
     $this->includeCustomTables();
     parent::delete();
 }
Ejemplo n.º 13
0
 function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 14
0
 /**
  * Will execute a task within a shipping plugin
  *
  * (non-PHPdoc)
  * @see application/component/JController::execute()
  */
 function execute($task)
 {
     $app = JFactory::getApplication();
     $shippingTask = $app->input->getCmd('shippingTask', '');
     $values = $app->input->getArray($_POST);
     //print_r($values);
     // Check if we are in a shipping method view. If it is so,
     // Try lo load the shipping plugin controller (if any)
     if ($task == "view" && $shippingTask != '') {
         $model = $this->getModel('Shipping', 'J2StoreModel');
         $id = $app->input->getInt('id', '0');
         if (!$id) {
             parent::execute($task);
         }
         $model->setId($id);
         // get the data
         // not using getItem here to enable ->checkout (which requires JTable object)
         $row = $model->getTable();
         $row->load((int) $model->getId());
         $element = $row->element;
         // The name of the Shipping Controller should be the same of the $_element name,
         // without the shipping_ prefix and with the first letter Uppercase, and should
         // be placed into a controller.php file inside the root of the plugin
         // Ex: shipping_standard => J2StoreControllerShippingStandard in shipping_standard/controller.php
         $controllerName = str_ireplace('shipping_', '', $element);
         $controllerName = ucfirst($controllerName);
         $path = JPATH_SITE . '/plugins/j2store/';
         $controllerPath = $path . $element . '/' . $element . '/controller.php';
         if (file_exists($controllerPath)) {
             require_once $controllerPath;
         } else {
             $controllerName = '';
         }
         $className = 'J2StoreControllerShipping' . $controllerName;
         if ($controllerName != '' && class_exists($className)) {
             // Create the controller
             $controller = new $className();
             // Add the view Path
             $controller->addViewPath($path);
             // Perform the requested task
             $controller->execute($shippingTask);
             // Redirect if set by the controller
             $controller->redirect();
         } else {
             parent::execute($task);
         }
     } else {
         parent::execute($task);
     }
 }
Ejemplo n.º 15
0
 function display($cachable = false, $urlparams = array())
 {
     JRequest::setVar('view', 'Info');
     parent::display();
 }
Ejemplo n.º 16
0
 function display($cachable = false, $urlparams = array())
 {
     JFactory::getApplication()->input->set('view', 'cpanel');
     parent::display();
 }
Ejemplo n.º 17
0
 function __construct($config = array())
 {
     parent::__construct($config);
 }