Exemple #1
0
 /**
  * Display method
  *
  * @param string $tpl
  * @return null
  */
 public function display($tpl = null)
 {
     // Add CSS-code
     $this->addCss('backend.css', 'media/com_magebridge/css/');
     if (MageBridgeHelper::isJoomla25()) {
         $this->addCss('backend-j25.css', 'media/com_magebridge/css/');
     }
     if (MageBridgeHelper::isJoomla35()) {
         $this->addCss('backend-j35.css', 'media/com_magebridge/css/');
     }
     // If we detect the API is down, report it
     $bridge = MageBridgeModelBridge::getInstance();
     if ($bridge->getApiState() != null) {
         $message = null;
         switch (strtoupper($bridge->getApiState())) {
             case 'EMPTY METADATA':
                 $message = JText::_('COM_MAGEBRIDGE_VIEW_API_ERROR_EMPTY_METADATA');
                 break;
             case 'SUPPORTKEY FAILED':
                 $message = JText::sprintf('COM_MAGEBRIDGE_VIEW_API_ERROR_KEY_FAILED', $bridge->getApiExtra());
                 break;
             case 'AUTHENTICATION FAILED':
                 $message = JText::_('COM_MAGEBRIDGE_VIEW_API_ERROR_AUTHENTICATION_FAILED');
                 break;
             case 'INTERNAL ERROR':
                 $message = JText::sprintf('COM_MAGEBRIDGE_VIEW_API_ERROR_INTERNAL_ERROR', MageBridgeHelper::getHelpLink('troubleshooting'));
                 break;
             case 'FAILED LOAD':
                 $message = JText::sprintf('COM_MAGEBRIDGE_VIEW_API_ERROR_FAILED_LOAD', MageBridgeHelper::getHelpLink('faq-troubleshooting:api-widgets'));
                 break;
             default:
                 $message = JText::sprintf('COM_MAGEBRIDGE_VIEW_API_ERROR_GENERIC', $bridge->getApiState());
                 break;
         }
         MageBridgeModelDebug::getInstance()->feedback($message);
     }
     // If debugging is enabled report it
     if (MagebridgeModelConfig::load('debug') == 1 && JFactory::getApplication()->input->getCmd('tmpl') != 'component' && in_array(JFactory::getApplication()->input->getCmd('view'), array('config', 'home'))) {
         MageBridgeModelDebug::getInstance()->feedback('COM_MAGEBRIDGE_VIEW_API_DEBUGGING_ENABLED');
     }
     parent::display($tpl);
 }
Exemple #2
0
 /**
  * Helper-method to initialize YireoCommonView-based views
  *
  * @param string $name
  * @return mixed
  */
 public static function initialize($title)
 {
     // Load important variables
     $document = JFactory::getDocument();
     $view = JFactory::getApplication()->input->getCmd('view');
     // Add CSS-code
     $document->addStyleSheet(JURI::root() . 'media/com_magebridge/css/backend.css');
     $document->addStyleSheet(JURI::root() . 'media/com_magebridge/css/backend-view-' . $view . '.css');
     if (MageBridgeHelper::isJoomla25()) {
         $document->addStyleSheet(JURI::root() . 'media/com_magebridge/css/backend-j25.css');
     }
     if (MageBridgeHelper::isJoomla35()) {
         $document->addStyleSheet(JURI::root() . 'media/com_magebridge/css/backend-j35.css');
     }
     // Page title
     $title = JText::_('COM_MAGEBRIDGE_VIEW_' . strtoupper(str_replace(' ', '_', $title)));
     JToolBarHelper::title('MageBridge: ' . $title, 'logo.png');
     // Add the menu
     self::addMenuItems();
 }