示例#1
0
	public static function loadBootstrap($version = 2, $type = 2)
	{
		$document = JFactory::getDocument();

		
		if ($document->getType() != 'html')
		{
			return true;
		}

		$isJoomla3x = JUDownloadHelper::isJoomla3x();
		$app        = JFactory::getApplication();

		
		if ($type == 0 && ($isJoomla3x || $app->isSite()))
		{
			return false;
		}

		
		$loadBootstrap = true;
		if ($type == 2 || $app->isAdmin())
		{
			$header  = $document->getHeadData();
			$scripts = $header['scripts'];
			if (count($scripts))
			{
				$pattern = '/([\/\\a-zA-Z0-9_:\.-]*)bootstrap.([0-9\.-]|core|custom|min|pack)*?.js(.*?)/i';
				foreach ($scripts AS $script => $opts)
				{
					if (preg_match($pattern, $script))
					{
						$loadBootstrap = false;
						break;
					}
				}
			}
		}

		
		if ($loadBootstrap)
		{
			JUDownloadFrontHelper::loadjQuery();

			if ($version == 2)
			{
				if (!$isJoomla3x)
				{
					$document->addScript(JUri::root(true) . '/components/com_judownload/assets/bootstrap2/js/bootstrap.min.js');
					$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/bootstrap2/css/bootstrap.min.css');
					$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/bootstrap2/css/bootstrap-responsive.min.css');

					$document->addScriptDeclaration('
					jQuery(document).ready(function($){
						$(\'.hasTooltip\').tooltip({\'html\': true, trigger: \'hover\'}).bind(\'hidden\', function () {
					        $(this).show();
					    });
					});
				');
				}
				else
				{
					JHtml::_('bootstrap.framework');
					if ($app->isSite())
					{
						
					}
				}
			}
			elseif ($version == 3)
			{
				$document->addScript(JUri::root(true) . '/components/com_judownload/assets/bootstrap3/js/bootstrap.min.js');
				$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/bootstrap3/css/bootstrap.min.css');
				

				
			}
		}

		
		if ($app->isAdmin())
		{
			$document->addScript(JUri::root(true) . '/administrator/components/com_judownload/assets/js/bootstrap-hover-dropdown.js');
		}
	}
示例#2
0
$app      = JFactory::getApplication();
$document = JFactory::getDocument();

// Name of current template that component using
//$this->template

// Name of this template
$self_template = basename(dirname(__FILE__));

$templateStyle = JUDownloadFrontHelperTemplate::getCurrentTemplateStyle();
$templateParams = $templateStyle->params;

//Load font awesome icon
$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/css/font-awesome.min.css');

JUDownloadFrontHelper::loadjQuery();
JUDownloadFrontHelper::loadBootstrap(3, $templateParams->get('load_bootstrap', '2'));

$JUDLTemplateDefaultHelper = new JUDLTemplateDefaultHelper($self_template);

$document->addStyleSheet(JUri::root(true) . "/components/com_judownload/assets/css/reset.css");
$document->addStyleSheet(JUri::root(true) . "/components/com_judownload/assets/css/core.css");
$document->addStyleSheet(JUri::root(true) . "/components/com_judownload/templates/" . $self_template . "/assets/css/common.css");

// Define a variable that allows google analytics tracks download (core.js)
$document->addScriptDeclaration("
	var google_analytics_track_download = " . $this->params->get("google_analytics_track_download", 0) . ";
");

// JText in core.js
JText::script('COM_JUDOWNLOAD_DOWNLOAD');
示例#3
0
	public function __construct($field = null, $doc = null)
	{
		
		if (is_null($field))
		{
			$field = $this->field_name;
		}

		if (is_object($field))
		{
			
			JUDownloadFrontHelperField::getFieldById($field->id, $field);
		}
		else
		{
			
			$field = JUDownloadFrontHelperField::getFieldById($field);
		}

		if (!is_object($field))
		{
			
			return false;
		}

		$this->id = $field->id;

		$this->params = new JRegistry($field->params);

		
		if (is_null($this->fieldvalue_column))
		{
			
			if ($this->isCore())
			{
				$this->fieldvalue_column = "d." . $this->field_name;
			}
			else
			{
				$this->fieldvalue_column = "field_values_" . $this->id . ".value";
			}
		}

		
		if (!$this->isCore())
		{
			$this->loadLanguage($this->folder);
		}

		
		

		$this->loadDocument($doc);

		$this->name = "fields[" . $this->id . "]";

		if ($this->params->get('auto_suggest', 0))
		{
			$app = JFactory::getApplication();
			if (($app->isAdmin() && ($app->input->get('view', '') == 'document' || $app->input->get('view', '') == 'field')) || ($app->isSite() && $app->input->get('view', '') == 'form'))
			{
				$document = JFactory::getDocument();
				$document->addStyleSheet(JUri::root() . "components/com_judownload/assets/css/typeahead.css");

				JUDownloadFrontHelper::loadjQuery();
				$document->addScript(JUri::root() . "components/com_judownload/assets/js/handlebars.min.js");
				$document->addScript(JUri::root() . "components/com_judownload/assets/js/typeahead.bundle.min.js");
				$document->addScript(JUri::root() . "components/com_judownload/assets/js/typeahead.config.js");
				$script = "var JURI_ROOT = '" . JUri::root() . "';";
				$document->addScriptDeclaration($script);
			}
		}

		return true;
	}