Пример #1
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() !== 'modal') {
         OSMapHelper::addSubmenu('sitemaps');
     }
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $version = new JVersion();
     $message = $this->get('ExtensionsMessage');
     if ($message) {
         JFactory::getApplication()->enqueueMessage($message);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
             $tpl = 'legacy';
         }
         $this->addToolbar();
     }
     // Load the extension
     $extension = Factory::getExtension('OSMap', 'component');
     $extension->loadLibrary();
     $displayLegacyStats = (bool) $extension->params->get('display_legacy_stats', 0);
     $this->assignRef("extension", $extension);
     $this->assignRef("displayLegacyStats", $displayLegacyStats);
     parent::display($tpl);
 }
Пример #2
0
 /**
  * Display the view
  *
  * @access    public
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $version = new JVersion();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     JHTML::stylesheet('administrator/components/com_osmap/css/osmap.css');
     // Convert dates from UTC
     $offset = $app->getCfg('offset');
     if (intval($this->item->created)) {
         $this->item->created = JHtml::date($this->item->created, '%Y-%m-%d %H-%M-%S', $offset);
     }
     $this->_setToolbar();
     if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
         $tpl = 'legacy';
     }
     // Load the extension
     $extension = Factory::getExtension('OSMap', 'component');
     $extension->loadLibrary();
     $this->assignRef("extension", $extension);
     parent::display($tpl);
     JRequest::setVar('hidemainmenu', true);
 }
Пример #3
0
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->model = $this->getModel();
     JTable::addIncludePath(JPATH_COMPONENT . '/tables');
     $mainframe = JFactory::getApplication();
     $cid = JRequest::getVar("cid");
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     $item = JTable::getInstance("document", "OSDownloadsTable");
     $item->load($cid);
     if ($item->description_1) {
         $item->description_1 = $item->brief . "<hr id=\"system-readmore\" />" . $item->description_1;
     } else {
         $item->description_1 = $item->brief;
     }
     $this->form->bind($item);
     // Load the extension
     $extension = Factory::getExtension('OSDownloads', 'component');
     $extension->loadLibrary();
     // Add the agreementLink property
     if (!empty($item)) {
         $item->agreementLink = '';
         if ((bool) $item->require_agree) {
             $item->agreementLink = JRoute::_('index.php?option=com_content&view=article&id=' . (int) $item->agreement_article_id);
         }
     }
     $this->assignRef("item", $item);
     $this->assignRef("extension", $extension);
     $this->addToolbar();
     parent::display($tpl);
 }
Пример #4
0
 public static function getExtensionForElement($element)
 {
     $info = static::getExtensionInfoFromElement($element);
     if (!empty($info['type']) && !empty($info['namespace'])) {
         return Factory::getExtension($info['namespace'], $info['type'], $info['group']);
     }
     return null;
 }
Пример #5
0
 public function __construct($config = array())
 {
     if (version_compare(JVERSION, '3.0', 'lt')) {
         $this->option = JRequest::getCmd('option');
     } else {
         $app = Factory::getApplication();
         $this->option = $app->input->get('option');
     }
     $info = ExtensionHelper::getExtensionInfoFromElement($this->option);
     $this->extension = Factory::getExtension($info['namespace'], $info['type']);
 }
Пример #6
0
 public function __construct($default = array())
 {
     parent::__construct($default);
     $this->registerTask('apply', 'save');
     $this->registerTask('unpublish', 'publish');
     $this->registerTask('orderup', 'reorder');
     $this->registerTask('orderdown', 'reorder');
     // Load the extension
     $this->extension = Factory::getExtension('OSDownloads', 'component');
     $this->extension->loadLibrary();
 }
Пример #7
0
 /**
  * Method to get the row form.
  *
  * @param   array    $data      Data for the form.
  * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
  *
  * @return  mixed    A JForm object on success, false on failure
  *
  * @since   1.6
  */
 public function getForm($data = array(), $loadData = true)
 {
     // Get the form.
     $form = $this->loadForm('com_osdownloads.file', 'file', array('control' => 'jform', 'load_data' => $loadData));
     // Load the extension
     $extension = Factory::getExtension('OSDownloads', 'component');
     $extension->loadLibrary();
     if ($extension->isPro()) {
         $form->loadFile(JPATH_COMPONENT . '/models/forms/file_pro.xml', true);
     }
     if (empty($form)) {
         return false;
     }
     return $form;
 }
Пример #8
0
 /**
  * Method to load the extension data
  * @return void
  */
 protected function loadExtension()
 {
     if (!isset($this->extension)) {
         $this->extension = Factory::getExtension($this->namespace, 'plugin', $this->_type);
     }
 }