/**
  * Update schemas of com_crowdfunding.
  *
  * @param array $results
  * @param JDatabaseDriver $db
  *
  * @throws Exception
  */
 protected function updateCrowdfunding($results, $db)
 {
     $extensions = 'com_crowdfunding';
     JLoader::import('Crowdfunding.Version');
     $version = new Crowdfunding\Version();
     if (version_compare($results[$extensions]['version_id'], $version->getShortVersion(), '<')) {
         $query = $db->getQuery(true);
         $query->update($db->quoteName('#__schemas'))->set($db->quoteName('version_id') . '=' . $db->quote($version->getShortVersion()))->where($db->quoteName('extension_id') . ' = ' . $db->quote($results[$extensions]['extension_id']));
         $db->setQuery($query);
         $db->execute();
         $msg = JText::sprintf('PLG_SYSTEM_DISTRIBUTION_MIGRATION_UPDATED_SCHEMAS_S', $extensions, $results[$extensions]['extension_id'], $results[$extensions]['version_id'], $version->getShortVersion());
         JFactory::getApplication()->enqueueMessage($msg);
     }
 }
示例#2
0
 /**
  * Prepares the document
  */
 protected function prepareDocument()
 {
     // Prepare page suffix
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $menus = $this->app->getMenu();
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $menu->title);
     } else {
         $this->params->def('page_heading', JText::_('COM_CROWDFUNDING_RAISE_DEFAULT_PAGE_TITLE'));
     }
     // Prepare page title
     $title = $menu->title;
     if (!$title) {
         $title = $this->app->get('sitename');
         // Set site name if it is necessary ( the option 'sitename' = 1 )
     } elseif ($this->app->get('sitename_pagetitles', 0)) {
         $title = JText::sprintf('JPAGETITLE', $this->app->get('sitename'), $title);
         // Item title to the browser title.
     } else {
         if ($this->item !== null) {
             $title .= ' | ' . $this->escape($this->item->title);
         }
     }
     $this->document->setTitle($title);
     // Meta Description
     $this->document->setDescription($this->params->get('menu-meta_description'));
     // Meta keywords
     $this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
     // Add current layout into breadcrumbs.
     $pathway = $this->app->getPathway();
     $pathway->addItem($this->pathwayName);
     // Scripts
     if ($this->userId) {
         JHtml::_('behavior.core');
         JHtml::_('behavior.keepalive');
         if ($this->params->get('enable_chosen', 1)) {
             JHtml::_('formbehavior.chosen', '.cf-advanced-select');
         }
     }
     $version = new Crowdfunding\Version();
     switch ($this->layout) {
         case 'rewards':
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_REWARD');
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
             JText::script('COM_CROWDFUNDING_PICK_IMAGE');
             // Scripts
             if ($this->params->get('rewards_images', 0)) {
                 JHtml::_('Prism.ui.bootstrap3Fileinput');
             }
             JHtml::_('Prism.ui.pnotify');
             JHtml::_('Prism.ui.joomlaHelper');
             $this->document->addScript('media/' . $this->option . '/js/site/project_rewards.js?v=' . $version->getShortVersion());
             break;
         case 'funding':
             JHtml::_('Prism.ui.parsley');
             JHtml::_('Prism.ui.bootstrap3Datepicker');
             $this->document->addScript('media/' . $this->option . '/js/site/project_funding.js?v=' . $version->getShortVersion());
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_THIS_VALUE_IS_REQUIRED');
             break;
         case 'story':
             // Scripts
             JHtml::_('Prism.ui.bootstrap3FileInput');
             // Include translation of the confirmation question for image removing.
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
             JText::script('COM_CROWDFUNDING_PICK_IMAGE');
             JText::script('COM_CROWDFUNDING_REMOVE');
             $this->document->addScript('media/' . $this->option . '/js/site/project_story.js?v=' . $version->getShortVersion());
             break;
         case 'manager':
             $this->document->addScript('media/' . $this->option . '/js/site/project_manager.js?v=' . $version->getShortVersion());
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_QUESTION_LAUNCH_PROJECT');
             JText::script('COM_CROWDFUNDING_QUESTION_STOP_PROJECT');
             break;
         case 'extras':
             JHtml::_('Prism.ui.serializeJson');
             break;
         default:
             // Basic
             if ($this->userId) {
                 JHtml::_('Prism.ui.bootstrapMaxLength');
                 JHtml::_('Prism.ui.bootstrap3Typeahead');
                 JHtml::_('Prism.ui.parsley');
                 JHtml::_('Prism.ui.cropper');
                 JHtml::_('Prism.ui.fileupload');
                 JHtml::_('Prism.ui.pnotify');
                 JHtml::_('Prism.ui.joomlaHelper');
                 $this->document->addScript('media/' . $this->option . '/js/site/project_basic.js?v=' . $version->getShortVersion());
                 // Load language string in JavaScript
                 JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
                 // Provide image size.
                 $js = '
                 var cfImageWidth  = ' . $this->params->get('image_width', 200) . ';
                 var cfImageHeight = ' . $this->params->get('image_height', 200) . ';
             ';
                 $this->document->addScriptDeclaration($js);
             }
             break;
     }
 }