public function display($tpl = null)
 {
     $application = JFactory::getApplication();
     $params = $application->getParams();
     // Set the request based upon the choosen layout
     switch ($this->getLayout()) {
         case 'logout':
             $intermediate_page = $params->get('intermediate_page');
             if ($intermediate_page != 1) {
                 $this->setRequest('customer/account/logout');
             } else {
                 $logout_url = MageBridgeUrlHelper::route('customer/account/logout');
                 $this->assignRef('logout_url', $logout_url);
             }
             break;
         default:
             $this->setRequest(MageBridgeUrlHelper::getLayoutUrl($this->getLayout()));
             break;
     }
     // Set which block to display
     $this->setBlock('content');
     // Assign the parameters to this template
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Beispiel #2
0
 /**
  * Display method
  *
  * @param string $tpl
  * @return null
  */
 public function display($tpl = null)
 {
     // Fetch this item
     $this->fetchItem();
     // Initialize the form-file
     $file = JPATH_ADMINISTRATOR . '/components/com_magebridge/models/product.xml';
     // Prepare the params-form
     $params = YireoHelper::toRegistry($this->item->params)->toArray();
     $params_form = JForm::getInstance('params', $file);
     $params_form->bind(array('params' => $params));
     $this->params_form = $params_form;
     // Prepare the actions-form
     $actions = YireoHelper::toRegistry($this->item->actions)->toArray();
     $actions_form = JForm::getInstance('actions', $file);
     JPluginHelper::importPlugin('magebridgeproduct');
     JFactory::getApplication()->triggerEvent('onMageBridgeProductPrepareForm', array(&$actions_form, (array) $this->item));
     $actions_form->bind(array('actions' => $actions));
     $this->actions_form = $actions_form;
     // Build the fields
     $this->lists['product'] = MageBridgeFormHelper::getField('magebridge.product', 'sku', $this->item->sku, null);
     // Check for a previous connector-value
     if (!empty($this->item->connector)) {
         $plugin = JPluginHelper::getPlugin('magebridgeproduct', $this->item->connector);
         if (empty($plugin)) {
             $plugin_warning = JText::sprintf('COM_MAGEBRIDGE_PRODUCT_PLUGIN_WARNING', $this->item->connector);
             JError::raiseWarning(500, $plugin_warning);
         }
     }
     parent::display($tpl);
 }
Beispiel #3
0
 /**
  * Method to display the requested view
  */
 public function display($tpl = null)
 {
     // Set which block to display
     $this->setBlock('content');
     // Build the bridge right away, because we need data from Magento
     $block = $this->build();
     // Determine which template to display
     if (MageBridgeTemplateHelper::isProductPage()) {
         $tpl = 'product';
     } else {
         if (MageBridgeTemplateHelper::isCategoryPage()) {
             $tpl = 'category';
         }
     }
     // Output component-only pages
     $bridge = MageBridge::getBridge();
     if ($bridge->isAjax()) {
         print $block;
         JFactory::getApplication()->close();
     }
     // Add controller information
     $mageConfig = $bridge->getMageConfig();
     $this->mage_controller = isset($mageConfig['controller']) ? $mageConfig['controller'] : null;
     $this->mage_action = isset($mageConfig['action']) ? $mageConfig['action'] : null;
     // Assemble the page class
     $contentClass = array('magebridge-content');
     if (!empty($mageController)) {
         $contentClass[] = 'magebridge-' . $mageController;
     }
     if (!empty($mageAction)) {
         $contentClass[] = 'magebridge-' . $mageController . '-' . $mageAction;
     }
     $this->content_class = $contentClass;
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Page title
     $this->setTitle('Updates');
     // Toolbar options
     JToolBarHelper::custom('refresh', 'preview.png', 'preview_f2.png', 'Refresh', false);
     // Add jQuery for selection effects
     MageBridgeTemplateHelper::load('jquery');
     JHTML::script('media/com_magebridge/js/backend-update.js');
     $update = MAGEBRIDGE_UPDATE_NOTAVAILABLE;
     $component_version = null;
     $data = MageBridgeUpdateHelper::getData();
     foreach ($data as $index => $extension) {
         if (empty($extension['latest_version'])) {
             continue;
         }
         if ($extension['current_version'] != $extension['latest_version']) {
             $update = MAGEBRIDGE_UPDATE_AVAILABLE;
             break;
         } else {
             $update = MAGEBRIDGE_UPDATE_NOTNEEDED;
         }
         $data[$index] = $extension;
     }
     if ($update != MAGEBRIDGE_UPDATE_NOTAVAILABLE) {
         JToolBarHelper::custom('update', 'download.png', 'download_f2.png', 'Update', false);
     }
     if ($update == MAGEBRIDGE_UPDATE_AVAILABLE) {
         JError::raiseNotice('UPDATE', 'There are new updates available');
     }
     $this->assignRef('data', $data);
     $this->assignRef('update', $update);
     parent::display($tpl);
 }
Beispiel #5
0
 /**
  * Method to prepare the content for display
  *
  * @param string $tpl
  * @return null
  */
 public function display($tpl = null)
 {
     // Fetch this item
     $this->fetchItem();
     // Build the fields
     $this->lists['source_type'] = $this->getFieldSourceType($this->item->source_type);
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Add CSS
     JHTML::stylesheet('media/com_magebridge/css/backend-elements.css');
     $this->assignRef('current', JRequest::getVar('current'));
     $this->assignRef('object', JRequest::getVar('object'));
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Initialize the view
     $this->setTitle('Users');
     // Set toolbar items for the page
     MageBridgeToolBarHelper::help('magebridge.users');
     JToolBarHelper::custom('export', 'export.png', null, 'Export', false);
     JToolBarHelper::custom('import', 'import.png', null, 'Import', false);
     // Initialize common variables
     $application = JFactory::getApplication();
     $option = JRequest::getCmd('option') . '-users';
     // Handle the filters
     $filter_type = $application->getUserStateFromRequest($option . 'filter_type', 'filter_type', '', 'word');
     $filter_state = $application->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word');
     $filter_order = $application->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'p.ordering', 'cmd');
     $filter_order_Dir = $application->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     // Get data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     // Table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // Prepare the items for display
     if (!empty($items)) {
         // Get a matching user list from the API
         $musers = $this->getMagentoUsers($items);
         foreach ($items as $index => $item) {
             $item->magento_name = null;
             $item->magento_id = null;
             if (!empty($musers)) {
                 foreach ($musers as $muser) {
                     if ($muser['email'] == $item->email) {
                         $item->magento_name = $muser['name'];
                         $item->magento_id = $muser['entity_id'];
                         break;
                     }
                 }
             }
             // Make sure demo-users are not seeing any sensitive data
             if (MageBridgeAclHelper::isDemo() == true) {
                 $censored_values = array('name', 'username', 'email', 'magento_name');
                 foreach ($censored_values as $censored_value) {
                     $item->{$censored_value} = str_repeat('*', strlen($item->{$censored_value}));
                 }
             }
             $item->migrate_link = 'index.php?option=com_magebridge&view=user&task=migrate&cid[]=' . $item->id;
             $items[$index] = $item;
         }
     }
     $user = JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Initialize the view
     $this->setTitle('Connectors');
     // Set buttons in the toolbar
     MageBridgeToolBarHelper::help('magebridge.connectors');
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::editListX();
     // Initialize common variables
     $application = JFactory::getApplication();
     $option = JRequest::getCmd('option') . '-connectors';
     // Handle the filters
     $filter_type = $application->getUserStateFromRequest($option . 'filter_type', 'filter_type', '', 'word');
     $filter_state = $application->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word');
     $filter_order = $application->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'p.ordering', 'cmd');
     $filter_order_Dir = $application->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     // Get data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     // filters
     $options = array(array('value' => '', 'text' => '- Select Type -'), array('value' => 'store', 'text' => 'Store Connectors'), array('value' => 'product', 'text' => 'Product Connectors'), array('value' => 'profile', 'text' => 'Profile Connectors'));
     $javascript = 'onchange="document.adminForm.submit();"';
     $lists['type'] = JHTML::_('select.genericlist', $options, 'filter_type', $javascript, 'value', 'text', $filter_type);
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // Prepare the items for display
     if (!empty($items)) {
         foreach ($items as $index => $item) {
             if ($item->type == 'product') {
                 $object = MageBridgeConnectorProduct::getInstance()->getConnectorObject($item);
             } else {
                 if ($item->type == 'profile') {
                     $object = MageBridgeConnectorProfile::getInstance()->getConnectorObject($item);
                 } else {
                     $object = MageBridgeConnectorStore::getInstance()->getConnectorObject($item);
                 }
             }
             if (is_object($object)) {
                 $item->enabled = $object->isEnabled();
             } else {
                 $item->enabled = false;
             }
             $item->edit_link = 'index.php?option=com_magebridge&view=connector&task=edit&cid[]=' . $item->id;
             $items[$index] = $item;
         }
     }
     $user = JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
 /**
  * Display method
  *
  * @param string $tpl
  *
  * @return string
  */
 public function display($tpl = null)
 {
     // Add CSS
     JHTML::stylesheet('media/com_magebridge/css/backend-elements.css');
     // Load jQuery
     YireoHelper::jquery();
     $this->current = JFactory::getApplication()->input->get('current');
     $this->object = JFactory::getApplication()->input->get('object');
     parent::display($tpl);
 }
 public function displayBrowser($tpl)
 {
     $this->setTitle('Browse-test Magento');
     JToolBarHelper::custom('refresh', 'preview.png', 'preview_f2.png', 'Browse', false);
     $url = MagebridgeModelConfig::load('url') . 'magebridge.php';
     $host = MagebridgeModelConfig::load('host');
     $this->assignRef('url', $url);
     $this->assignRef('host', $host);
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Initialize the view
     $this->setTitle('Edit connector');
     // Initialize common variables
     $application = JFactory::getApplication();
     $user = JFactory::getUser();
     $option = JRequest::getCmd('option');
     // Get data from the model
     $model = $this->getModel();
     $item = $this->get('Data');
     // Get the item
     $item = $this->get('data');
     $isNew = $item->id < 1;
     // Fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('Item locked', $item->name);
         $application->redirect('index.php?option=' . $option, $msg);
     }
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $item->published = 1;
         $item->order = 0;
     }
     // Build the HTML-select list for ordering
     $query = 'SELECT ordering AS value, name AS text' . ' FROM #__magebridge_connectors' . ' ORDER BY ordering';
     // Build the fields
     $fields = array();
     $fields['ordering'] = JHTML::_('list.specificordering', $item, $item->id, $query);
     $fields['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $item->published);
     // Read the connector-parameters
     $params = null;
     if (!empty($item->name) && !empty($item->type)) {
         $file = JPATH_SITE . '/components/com_magebridge/connectors/' . $item->type . '/' . $item->name . '.xml';
         if (is_file($file)) {
             $params = new JParameter($item->params, $file);
         }
     }
     // Clean the object before displaying
     JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, 'text');
     // Get the pane
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('sliders');
     $this->assignRef('user', JFactory::getUser());
     $this->assignRef('fields', $fields);
     $this->assignRef('params', $params);
     $this->assignRef('pane', $pane);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Load the bridge
     $bridge = MageBridgeModelBridge::getInstance();
     // Load the parameters
     $layout = $this->getLayout();
     $params = MageBridgeHelper::getParams();
     // Set the request based upon the choosen category
     $request = $params->get('request', false) ? $params->get('request') : MageBridgeUrlHelper::getRequest();
     $prefix = preg_replace('/\\?(.*)/', '', $request);
     $suffix = preg_replace('/(.*)\\?/', '', $request);
     // Check if this a non-URL-optimized request
     if (is_numeric($prefix)) {
         $request = MageBridgeUrlHelper::getLayoutUrl($layout, $prefix);
     } else {
         // Determine the suffix
         if ($layout == 'product') {
             $suffix = $bridge->getMageConfig('catalog/seo/product_url_suffix');
         } else {
             if ($layout == 'category') {
                 $suffix = $bridge->getMageConfig('catalog/seo/category_url_suffix');
             }
         }
         // Add the suffix, if this is set in the Magento configuration
         if (!empty($suffix) && !preg_match('/' . $suffix . '$/', $request)) {
             $request .= $suffix;
         }
     }
     // Add the
     $mode = $params->get('mode');
     if (!empty($mode)) {
         $request .= '?mode=' . $mode;
     }
     // Set the request in the bridge
     $this->setRequest($request);
     // Handle the redirect request
     $redirect = JRequest::getString('redirect');
     if (!empty($redirect)) {
         $bridge->setHttpReferer($redirect);
     }
     // Reuse this request to set the Canonical URL
     if (MagebridgeModelConfig::load('enable_canonical') == 1) {
         $uri = MageBridgeUrlHelper::route($request);
         $document = JFactory::getDocument();
         $document->setMetaData('canonical', $uri);
     }
     // Set which block to display
     $this->setBlock('content');
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     switch (JRequest::getVar('layout')) {
         case 'feeds':
             $feeds = $this->fetchFeeds('http://www.yireo.com/blog?format=feed&type=rss', 3);
             $this->assignRef('feeds', $feeds);
             break;
         case 'promotion':
             $html = $this->fetchPage('http://www.yireo.com/advertizement.php');
             print $html;
             exit;
     }
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Load the parameters
     $params = MageBridgeHelper::getParams();
     $request = $params->get('request');
     $this->setRequest($request);
     // Reuse this request to set the Canonical URL
     if (MagebridgeModelConfig::load('enable_canonical') == 1) {
         $uri = MageBridgeUrlHelper::route($request);
         $document = JFactory::getDocument();
         $document->setMetaData('canonical', $uri);
     }
     // Set which block to display
     $this->setBlock('content');
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Initialize the view
     $this->setTitle('Edit usergroup relation');
     // Initialize common variables
     $application = JFactory::getApplication();
     $user = JFactory::getUser();
     $option = JRequest::getCmd('option');
     // Get data from the model
     $model = $this->getModel();
     $item = $this->get('Data');
     // Get the item
     $item = $this->get('data');
     $isNew = $item->id < 1;
     // Fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('Item locked', $item->name);
         $application->redirect('index.php?option=' . $option, $msg);
     }
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $item->published = 1;
         $item->order = 0;
     }
     // Before loading anything, we build the bridge
     $this->preBuildBridge();
     // Build the HTML-select list for ordering
     $query = 'SELECT ordering AS value, description AS text' . ' FROM #__magebridge_usergroups' . ' ORDER BY ordering';
     // Build the fields
     $fields = array();
     $fields['joomla_group'] = $this->getFieldJoomlaGroup($item->joomla_group);
     $fields['magento_group'] = $this->getFieldMagentoGroup($item->magento_group);
     $fields['ordering'] = JHTML::_('list.specificordering', $item, $item->id, $query);
     $fields['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $item->published);
     // Clean the object before displaying
     JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, 'text');
     $user = JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('fields', $fields);
     $this->assignRef('params', $params);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Initialize the view
     $this->setTitle('Store Relations');
     // Set toolbar items for the page
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::deleteList();
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     // Initialize common variables
     $application = JFactory::getApplication();
     $option = JRequest::getCmd('option') . '-stores';
     // Handle the filters
     $filter_state = $application->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word');
     $filter_order = $application->getUserStateFromRequest($option . 'filter_order', 'filter_order', 's.ordering', 'cmd');
     $filter_order_Dir = $application->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     // Get data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     // state filter
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // Prepare the items for display
     if (!empty($items)) {
         foreach ($items as $index => $item) {
             $item->edit_link = 'index.php?option=com_magebridge&view=store&task=edit&cid[]=' . $item->id;
             $items[$index] = $item;
         }
     }
     // Get the current values
     $default = $this->getDefault();
     $user = JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('default', $default);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     $this->setTitle('Control Panel');
     $lang = JFactory::getLanguage();
     $alignment = $lang->isRTL() ? 'right' : 'left';
     $this->assignRef('alignment', $alignment);
     $icons = array();
     $icons[] = $this->icon('config', 'Configuration', 'config.png');
     $icons[] = $this->icon('stores', 'Store Conditions', 'store.png');
     $icons[] = $this->icon('products', 'Product Relations', 'product.png');
     $icons[] = $this->icon('connectors', 'Connectors', 'connect.png');
     $icons[] = $this->icon('users', 'Users', 'user.png');
     $icons[] = $this->icon('check', 'System Check', 'cpanel.png');
     $icons[] = $this->icon('logs', 'Logs', 'info.png');
     $icons[] = $this->icon('update', 'Update', 'install.png');
     $icons[] = $this->icon('cache', 'Empty Cache', 'trash.png');
     $icons[] = $this->icon('magento', 'Magento Admin', 'magento.png', '_blank');
     $icons[] = $this->icon('tutorials', 'Tutorials', 'tutorials.png', '_blank');
     $icons[] = $this->icon('forum', 'Forum', 'forum.png', '_blank');
     $this->assignRef('icons', $icons);
     //jimport('joomla.html.pane');
     //$pane = JPane::getInstance('sliders');
     //$this->assignRef('pane', $pane);
     $current_version = MageBridgeUpdateHelper::getComponentVersion();
     $this->assignRef('current_version', $current_version);
     $changelog_url = 'http://www.yireo.com/tutorials/magebridge/updates/975-magebridge-changelog';
     $this->assignRef('changelog_url', $changelog_url);
     $jed_url = 'http://extensions.joomla.org/extensions/bridges/e-commerce-bridges/9440';
     $this->assignRef('jed_url', $jed_url);
     $backend_feed = MagebridgeModelConfig::load('backend_feed');
     $this->assignRef('backend_feed', $backend_feed);
     if ($backend_feed == 1) {
         $this->ajax('index.php?option=com_magebridge&view=home&format=ajax&layout=feeds', 'latest_news');
         $this->ajax('index.php?option=com_magebridge&view=home&format=ajax&layout=promotion', 'promotion');
         $document = JFactory::getDocument();
         if (JURI::getInstance()->isSSL() == true) {
             $document->addStylesheet('https://fonts.googleapis.com/css?family=Just+Me+Again+Down+Here');
         } else {
             $document->addStylesheet('http://fonts.googleapis.com/css?family=Just+Me+Again+Down+Here');
         }
     }
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Set which block to display
     $this->setBlock('content');
     // Build the bridge right away, because we need data from Magento
     $this->build();
     // Determine which template to display
     if (MageBridgeTemplateHelper::isProductPage()) {
         $tpl = 'product';
     } else {
         if (MageBridgeTemplateHelper::isCategoryPage()) {
             $tpl = 'category';
         }
     }
     // Output component-only pages
     $bridge = MageBridge::getBridge();
     if ($bridge->isAjax()) {
         print $this->block;
         JFactory::getApplication()->close();
     }
     parent::display($tpl);
 }
Beispiel #19
0
 /**
  * Method to display the requested view
  */
 public function display($tpl = null)
 {
     // Load the parameters
     $params = MageBridgeHelper::getParams();
     // Load the request
     $request = $params->get('request');
     if (empty($request)) {
         $request = JFactory::getApplication()->input->getString('request');
     }
     // Remove the dummy ID from the request
     $request = preg_replace('/^([0-9]+)\\:/', '', $request);
     // Set the request
     $this->setRequest($request);
     // Reuse this request to set the Canonical URL
     if (MagebridgeModelConfig::load('enable_canonical') == 1) {
         $uri = MageBridgeUrlHelper::route($request);
         $document = JFactory::getDocument();
         $document->setMetaData('canonical', $uri);
     }
     // Set which block to display
     $this->setBlock('content');
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Initialize the view
     $this->setTitle('URL Replacements');
     // Set toolbar items for the page
     MageBridgeToolBarHelper::help('magebridge.urls');
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::deleteList();
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     // Initialize common variables
     $application = JFactory::getApplication();
     $option = JRequest::getCmd('option') . '-urls';
     // Handle the filters
     $filter_state = $application->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word');
     $filter_order = $application->getUserStateFromRequest($option . 'filter_order', 'filter_order', 's.ordering', 'cmd');
     $filter_order_Dir = $application->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     // Get data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     // Table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // Prepare the items for display
     if (!empty($items)) {
         foreach ($items as $index => $item) {
             $items[$index] = $item;
         }
     }
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Beispiel #21
0
 /**
  * Method to display the requested view
  */
 public function display($tpl = null)
 {
     // Load the bridge
     $bridge = MageBridgeModelBridge::getInstance();
     // Load the parameters
     $layout = $this->getLayout();
     $params = MageBridgeHelper::getParams();
     // Set the request based upon the choosen category
     $request = $params->get('request', false) ? $params->get('request') : MageBridgeUrlHelper::getRequest();
     $prefix = preg_replace('/\\?(.*)/', '', $request);
     $suffix = preg_replace('/(.*)\\?/', '', $request);
     // Check if this a non-URL-optimized request
     if (is_numeric($prefix)) {
         $request = MageBridgeUrlHelper::getLayoutUrl($layout, $prefix);
     } else {
         // Determine the suffix
         if ($layout == 'product') {
             $suffix = $bridge->getSessionData('catalog/seo/product_url_suffix');
         } else {
             if ($layout == 'category') {
                 $suffix = $bridge->getSessionData('catalog/seo/category_url_suffix');
             }
         }
         // Add the suffix, if this is set in the Magento configuration
         if (!empty($suffix) && !preg_match('/' . $suffix . '$/', $request)) {
             $request .= $suffix;
         }
     }
     // Add the qty parameter
     $qty = JFactory::getApplication()->input->getInt('qty');
     if (!empty($qty)) {
         $request .= 'qty/' . $qty . '/';
     }
     // Check for the redirect parameter
     $redirect = $this->input->getString('redirect');
     if ($layout == 'addtocart' && empty($redirect)) {
         $redirect = 'checkout/cart';
     }
     // Add the redirect parameter
     if (!empty($redirect)) {
         $redirect = MageBridgeUrlHelper::route($redirect);
         if (!empty($redirect)) {
             $request .= 'uenc/' . MageBridgeEncryptionHelper::base64_encode($redirect) . '/';
         }
         $form_key = MageBridgeModelBridge::getInstance()->getSessionData('form_key');
         if (!empty($form_key)) {
             $request .= 'form_key/' . $form_key;
         }
     }
     // Add the mode (for catalog)
     $mode = $params->get('mode');
     if (!empty($mode)) {
         $request .= '?mode=' . $mode;
     }
     // Set the request in the bridge and wait for the response
     $this->setRequest($request);
     // Reuse this request to set the Canonical URL
     if (MagebridgeModelConfig::load('enable_canonical') == 1) {
         $uri = MageBridgeUrlHelper::route($request);
         $document = JFactory::getDocument();
         $document->setMetaData('canonical', $uri);
     }
     // Set which block to display
     $this->setBlock('content');
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     $this->assignRef('offline_message', $this->getOfflineMessage());
     parent::display($tpl);
 }
Beispiel #23
0
 /**
  * Method to display the requested view
  */
 public function display($tpl = null)
 {
     $this->offline_message = $this->getOfflineMessage();
     parent::display($tpl);
 }
 public function showForm($tpl = null)
 {
     // Initialize the view
     $this->setTitle('Edit store condition');
     // Initialize common variables
     $application = JFactory::getApplication();
     $user = JFactory::getUser();
     $option = JRequest::getCmd('option');
     // Get data from the model
     $model = $this->getModel();
     $item = $this->get('Data');
     // Get the item
     $item = $this->get('data');
     $isNew = $item->id < 1;
     // Fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('Item locked', $item->name);
         $application->redirect('index.php?option=' . $option, $msg);
     }
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $item->published = 1;
         $item->order = 0;
     }
     // Build the HTML-select list for ordering
     $query = 'SELECT ordering AS value, name AS text' . ' FROM #__magebridge_stores' . ' ORDER BY ordering';
     // Build the fields
     $fields = array();
     $fields['store'] = $this->getFieldStore($item->type, $item->name);
     $fields['ordering'] = JHTML::_('list.specificordering', $item, $item->id, $query);
     $fields['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $item->published);
     // Clean the object before displaying
     JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, 'text');
     $this->assignRef('user', JFactory::getUser());
     $this->assignRef('connectors', MageBridgeConnectorStore::getInstance()->getConnectors());
     $this->assignRef('fields', $fields);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
Beispiel #25
0
 /**
  * Method to display the requested view
  */
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('MageBridge') . ': ' . JText::_('Magento Admin Panel'), 'yireo');
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     // Load important variables
     $application = JFactory::getApplication();
     $option = JRequest::getCmd('option') . '-connectors';
     $layout = JRequest::getCmd('layout');
     // Load the import-layout directly
     if ($layout == 'import') {
         return parent::display($tpl);
     }
     // Load the tabs
     jimport('joomla.html.pane');
     $activeTab = $application->getUserStateFromRequest($option . '.tab', 'tab', 1, 'int');
     $pane = JPane::getInstance('tabs', array('startOffset' => $activeTab));
     $this->assignRef('pane', $pane);
     // Page title
     if (MagebridgeModelConfig::load('advanced') == 1) {
         $this->setTitle('Configuration (Advanced Mode)');
     } else {
         $this->setTitle('Configuration (Basic Mode)');
     }
     // Deal with the advanced mode
     if (MagebridgeModelConfig::load('advanced') == 1) {
         $mode = 'advanced';
         $mode_button = 'Basic';
     } else {
         $mode = 'basic';
         $mode_button = 'Advanced';
     }
     // Toolbar options
     if (MageBridgeAclHelper::isDemo() == false) {
         JToolBarHelper::custom('export', 'export.png', null, 'Export', false);
         JToolBarHelper::custom('import', 'import.png', null, 'Import', false);
     }
     JToolBarHelper::custom('toggleMode', 'mode.png', 'mode.png', $mode_button, false);
     if (MageBridgeHelper::isJoomla15() == false) {
         JToolBarHelper::preferences('com_magebridge');
     }
     MageBridgeToolBarHelper::help('magebridge.configuration');
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel();
     JToolBarHelper::custom('cache', 'preview.png', 'preview_f2.png', 'Empty cache', false);
     // Extra scripts
     MageBridgeTemplateHelper::load('jquery');
     JHTML::_('script', 'media/com_magebridge/js/backend-config.js', '');
     // Before loading anything, we build the bridge
     $this->preBuildBridge();
     // Load the configuration and check it
     $config = MagebridgeModelConfig::load();
     $this->checkConfig();
     // Make sure demo-users are not seeing any sensitive data
     if (MageBridgeAclHelper::isDemo() == true) {
         $censored_values = array('license', 'api_user', 'api_key');
         foreach ($censored_values as $censored_value) {
             $config[$censored_value]['value'] = str_repeat('*', strlen($config[$censored_value]['value']));
         }
     }
     // Generate input fields
     $fields = array();
     $fields['disable_css'] = $this->getFieldDisableCss();
     $fields['disable_js_mage'] = $this->getFieldDisableJsMage();
     $fields['disable_js_all'] = $this->getFieldDisableJsJoomla();
     $fields['website'] = $this->getFieldWebsite();
     $fields['customer_group'] = $this->getFieldCustomerGroup();
     $fields['usergroup'] = $this->getFieldUsergroup();
     $fields['show_help'] = JHTML::_('select.booleanlist', 'show_help', null, $config['show_help']['value']);
     $fields['encryption'] = JHTML::_('select.booleanlist', 'encryption', null, $config['encryption']['value']);
     $fields['enable_sso'] = JHTML::_('select.booleanlist', 'enable_sso', null, $config['enable_sso']['value']);
     $fields['enable_usersync'] = JHTML::_('select.booleanlist', 'enable_usersync', null, $config['enable_usersync']['value']);
     $fields['username_from_email'] = JHTML::_('select.booleanlist', 'username_from_email', null, $config['username_from_email']['value']);
     $fields['realname_from_firstlast'] = JHTML::_('select.booleanlist', 'realname_from_firstlast', null, $config['realname_from_firstlast']['value']);
     $fields['enable_auth_backend'] = JHTML::_('select.booleanlist', 'enable_auth_backend', null, $config['enable_auth_backend']['value']);
     $fields['enable_auth_frontend'] = JHTML::_('select.booleanlist', 'enable_auth_frontend', null, $config['enable_auth_frontend']['value']);
     $fields['enable_canonical'] = JHTML::_('select.booleanlist', 'enable_canonical', null, $config['enable_canonical']['value']);
     $fields['protocol'] = $this->getFieldProtocol();
     $fields['method'] = $this->getFieldMethod();
     $fields['http_auth'] = JHTML::_('select.booleanlist', 'http_auth', null, $config['http_auth']['value']);
     $fields['http_authtype'] = $this->getFieldHttpAuthType();
     $fields['backend'] = $this->getFieldBackend();
     $fields['template'] = $this->getFieldTemplate();
     $fields['enforce_ssl'] = $this->getFieldEnforceSSL();
     $fields['update_format'] = $this->getFieldUpdateFormat();
     $fields['update_method'] = $this->getFieldUpdateMethod();
     $fields['debug_log'] = $this->getFieldDebugLog();
     $fields['debug_level'] = $this->getFieldDebugLevel();
     $fields['mobile_magento_theme'] = $this->getFieldMobileMagentoTheme();
     $fields['mobile_joomla_theme'] = $this->getFieldMobileJoomlaTheme();
     $fields['merge_js'] = $this->getFieldMergeJs();
     $fields['users_website_id'] = $this->getFieldUsersWebsiteId();
     $fields['users_group_id'] = $this->getFieldUsersGroupId();
     $fields['api_type'] = $this->getFieldApiType();
     $fields['api_widgets'] = JHTML::_('select.booleanlist', 'api_widgets', null, $config['api_widgets']['value']);
     $fields['preload_all_modules'] = JHTML::_('select.booleanlist', 'preload_all_modules', null, $config['preload_all_modules']['value']);
     $fields['advanced'] = JHTML::_('select.booleanlist', 'advanced', null, $config['advanced']['value']);
     $fields['use_rootmenu'] = JHTML::_('select.booleanlist', 'use_rootmenu', null, $config['use_rootmenu']['value']);
     $fields['enforce_rootmenu'] = JHTML::_('select.booleanlist', 'enforce_rootmenu', null, $config['enforce_rootmenu']['value']);
     $fields['enable_cache'] = JHTML::_('select.booleanlist', 'enable_cache', null, $config['enable_cache']['value']);
     $fields['enable_content_plugins'] = JHTML::_('select.booleanlist', 'enable_content_plugins', null, $config['enable_content_plugins']['value']);
     $fields['enable_block_rendering'] = JHTML::_('select.booleanlist', 'enable_block_rendering', null, $config['enable_block_rendering']['value']);
     $fields['enable_jdoc_tags'] = JHTML::_('select.booleanlist', 'enable_jdoc_tags', null, $config['enable_jdoc_tags']['value']);
     $fields['disable_default_css'] = JHTML::_('select.booleanlist', 'disable_default_css', null, $config['disable_default_css']['value']);
     $fields['disable_js_mootools'] = JHTML::_('select.booleanlist', 'disable_js_mootools', null, $config['disable_js_mootools']['value']);
     $fields['disable_js_footools'] = JHTML::_('select.booleanlist', 'disable_js_footools', null, $config['disable_js_footools']['value']);
     $fields['disable_js_frototype'] = JHTML::_('select.booleanlist', 'disable_js_frototype', null, $config['disable_js_frototype']['value']);
     $fields['disable_js_jquery'] = JHTML::_('select.booleanlist', 'disable_js_jquery', null, $config['disable_js_jquery']['value']);
     $fields['disable_js_prototype'] = JHTML::_('select.booleanlist', 'disable_js_prototype', null, $config['disable_js_prototype']['value']);
     $fields['use_google_api'] = JHTML::_('select.booleanlist', 'use_google_api', null, $config['use_google_api']['value']);
     $fields['use_protoaculous'] = JHTML::_('select.booleanlist', 'use_protoaculous', null, $config['use_protoaculous']['value']);
     $fields['use_protoculous'] = JHTML::_('select.booleanlist', 'use_protoculous', null, $config['use_protoculous']['value']);
     $fields['offline'] = JHTML::_('select.booleanlist', 'offline', null, $config['offline']['value']);
     $fields['debug'] = JHTML::_('select.booleanlist', 'debug', null, $config['debug']['value']);
     $fields['debug_bar'] = JHTML::_('select.booleanlist', 'debug_bar', null, $config['debug_bar']['value']);
     $fields['debug_console'] = JHTML::_('select.booleanlist', 'debug_console', null, $config['debug_console']['value']);
     $fields['debug_bar_parts'] = JHTML::_('select.booleanlist', 'debug_bar_parts', null, $config['debug_bar_parts']['value']);
     $fields['debug_bar_request'] = JHTML::_('select.booleanlist', 'debug_bar_request', null, $config['debug_bar_request']['value']);
     $fields['debug_bar_store'] = JHTML::_('select.booleanlist', 'debug_bar_store', null, $config['debug_bar_store']['value']);
     $fields['debug_display_errors'] = JHTML::_('select.booleanlist', 'debug_display_errors', null, $config['debug_display_errors']['value']);
     $fields['enable_messages'] = JHTML::_('select.booleanlist', 'enable_messages', null, $config['enable_messages']['value']);
     $fields['enable_notfound'] = JHTML::_('select.booleanlist', 'enable_notfound', null, $config['enable_notfound']['value']);
     $fields['modify_url'] = JHTML::_('select.booleanlist', 'modify_url', null, $config['modify_url']['value']);
     $fields['link_to_magento'] = JHTML::_('select.booleanlist', 'link_to_magento', null, $config['link_to_magento']['value']);
     $fields['spoof_browser'] = JHTML::_('select.booleanlist', 'spoof_browser', null, $config['spoof_browser']['value']);
     $fields['spoof_headers'] = JHTML::_('select.booleanlist', 'spoof_headers', null, $config['spoof_headers']['value']);
     $fields['curl_post_as_array'] = JHTML::_('select.booleanlist', 'curl_post_as_array', null, $config['curl_post_as_array']['value']);
     $fields['backend_feed'] = JHTML::_('select.booleanlist', 'backend_feed', null, $config['backend_feed']['value']);
     $fields['keep_alive'] = JHTML::_('select.booleanlist', 'keep_alive', null, $config['keep_alive']['value']);
     $fields['filter_content'] = JHTML::_('select.booleanlist', 'filter_content', null, $config['filter_content']['value']);
     $this->assignRef('mode', $mode);
     $this->assignRef('config', $config);
     $this->assignRef('fields', $fields);
     parent::display($tpl);
 }