public function __construct($field = null, $listing = null) { if (is_null($field)) { $field = $this->field_name; } if (is_object($field)) { JUDirectoryFrontHelperField::getFieldById($field->id, $field); } else { $field = JUDirectoryFrontHelperField::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 = "listing." . $this->field_name; } else { $this->fieldvalue_column = "field_values_" . $this->id . ".value"; } } if (!$this->isCore()) { $this->loadLanguage($this->folder); } $this->loadListing($listing); $this->name = "fields[" . $this->id . "]"; if ($this->params->get('auto_suggest', 0)) { $app = JFactory::getApplication(); if ($app->isAdmin() && ($app->input->get('view', '') == 'listing' || $app->input->get('view', '') == 'field') || $app->isSite() && $app->input->get('view', '') == 'form') { $document = JFactory::getDocument(); $document->addStyleSheet(JUri::root() . "components/com_judirectory/assets/css/typeahead.css"); JUDirectoryFrontHelper::loadjQuery(); $document->addScript(JUri::root() . "components/com_judirectory/assets/js/handlebars.min.js"); $document->addScript(JUri::root() . "components/com_judirectory/assets/js/typeahead.bundle.min.js"); $document->addScript(JUri::root() . "components/com_judirectory/assets/js/typeahead.config.js"); $script = "var JURI_ROOT = '" . JUri::root() . "';"; $document->addScriptDeclaration($script); } } return true; }
jimport('joomla.application.component.controller'); $app = JFactory::getApplication(); $task = $app->input->get('task'); $view = $app->input->get('view'); $permission = JUDirectoryHelper::checkGroupPermission($task, $view); if (!$permission) { return JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } if (!JFactory::getUser()->authorise('core.manage', 'com_judirectory')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $document = JFactory::getDocument(); $isJoomla3x = JUDirectoryHelper::isJoomla3x(); if ($isJoomla3x) { $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/styles.css'); } else { $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/styles.j25.css'); $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/jicomoon.css'); } JUDirectoryFrontHelper::loadjQuery(); JUDirectoryFrontHelper::loadBootstrap(); $document->addScript(JUri::root() . "components/com_judirectory/assets/js/jquery.dragsort.min.js"); if ($isJoomla3x && $view == 'subscriptions') { $document->addScript(JUri::base() . "components/com_judirectory/models/forms/subscriptions.js"); } if ($isJoomla3x && $view == 'collections') { $document->addScript(JUri::base() . "components/com_judirectory/models/forms/collections.js"); } $controller = JControllerLegacy::getInstance('JUDirectory'); $controller->execute($app->input->get('task')); $controller->redirect();
public static function loadBootstrap($version = 2, $type = 2) { $document = JFactory::getDocument(); if ($document->getType() != 'html') { return true; } $isJoomla3x = JUDirectoryHelper::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) { JUDirectoryFrontHelper::loadjQuery(); if ($version == 2) { if (!$isJoomla3x) { $document->addScript(JUri::root(true) . '/components/com_judirectory/assets/bootstrap2/js/bootstrap.min.js'); $document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap2/css/bootstrap.min.css'); $document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/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_judirectory/assets/bootstrap3/js/bootstrap.min.js'); $document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap3/css/bootstrap.min.css'); $document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap3/css/bootstrap-theme.min.css'); $document->addScriptDeclaration(' jQuery(document).ready(function($){ $(\'.hasTooltip\').tooltip({\'html\': true, trigger: \'hover\'}).bind(\'hidden\', function () { $(this).show(); }); }); '); } } if ($app->isAdmin()) { $document->addScript(JUri::root(true) . '/administrator/components/com_judirectory/assets/js/bootstrap-hover-dropdown.js'); } }