public function __set($name, $value) { switch ($name) { case 'height': case 'width': case 'assetField': case 'authorField': case 'asset': $this->{$name} = (string) $value; break; case 'buttons': $value = (string) $value; if ($value == 'true' || $value == 'yes' || $value == '1') { $this->buttons = true; } elseif ($value == 'false' || $value == 'no' || $value == '0') { $this->buttons = false; } else { $this->buttons = explode(',', $value); } break; case 'hide': $value = (string) $value; $this->hide = $value ? explode(',', $value) : array(); break; case 'editorType': $this->editorType = explode('|', trim((string) $value)); break; default: if (JUDirectoryHelper::isJoomla3x()) { parent::__set($name, $value); } else { $this->{$name} = $value; } } }
protected function getInput() { $language = JFactory::getLanguage(); $language->load('com_judirectory', JPATH_ADMINISTRATOR); $isJoomla3x = JUDirectoryHelper::isJoomla3x(); $fieldsGroup = JUDirectoryHelper::getAdvSearchFields(); $html = '<div id="judirectory-field" style="clear: both;">'; if ($isJoomla3x) { $html .= JHtml::_('bootstrap.startTabSet', 'search-form', array('active' => 'fieldgroup-1')); } else { $html .= JHtml::_('tabs.start', 'search-form'); } foreach ($fieldsGroup as $groupField) { if ($isJoomla3x) { $html .= JHtml::_('bootstrap.addTab', 'search-form', 'fieldgroup-' . $groupField->id, $groupField->name, true); } else { $html .= JHtml::_('tabs.panel', $groupField->name, 'fieldgroup-' . $groupField->id); } if (!$isJoomla3x) { $html .= '<fieldset class="adminform">'; $html .= '<ul class="adminformlist">'; } foreach ($groupField->fields as $field) { $value = isset($this->value[$field->id]) ? $this->value[$field->id] : ""; $fieldClass = JUDirectoryFrontHelperField::getField($field); if (JFactory::getApplication()->input->getCmd('view', '') == 'module') { $fieldClass->name = 'jform[params][fields][' . $fieldClass->id . ']'; } if ($isJoomla3x) { $html .= '<div class="control-group">'; $html .= '<div class="control-label">'; $html .= $fieldClass->getLabel(false); $html .= '</div>'; $html .= '<div class="controls">'; $html .= $fieldClass->getDisplayPrefixText() . $fieldClass->getSearchInput($value) . $fieldClass->getDisplaySuffixText(); $html .= "</div>"; $html .= "</div>"; } else { $html .= "<li>"; $html .= $fieldClass->getLabel(false); $html .= $fieldClass->getDisplayPrefixText() . $fieldClass->getSearchInput($value) . $fieldClass->getDisplaySuffixText(); $html .= "</li>"; } } if (!$isJoomla3x) { $html .= '</ul>'; $html .= '</fieldset>'; } if ($isJoomla3x) { $html .= JHtml::_('bootstrap.endTab'); } } if ($isJoomla3x) { $html .= JHtml::_('bootstrap.endTabSet'); } else { $html .= JHtml::_('tabs.end'); } $html .= '</div>'; return $html; }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $app = JFactory::getApplication(); if ($app->input->get('layout') == null) { $app->redirect('index.php?option=com_judirectory&view=listcats'); } $this->items = $this->get('Items'); $this->state = $this->get('State'); $this->authors = $this->get('Authors'); $this->pagination = $this->get('Pagination'); if ($app->input->get('layout') == 'copy') { JToolBarHelper::title(JText::_('COM_JUDIRECTORY_COPY_LISTINGS'), 'copy-listings'); JToolBarHelper::apply('listings.copyListings', 'JTOOLBAR_APPLY'); JToolBarHelper::cancel('listing.cancel', 'JTOOLBAR_CANCEL'); } elseif ($app->input->get('layout') == 'move') { JToolBarHelper::title(JText::_('COM_JUDIRECTORY_MOVE_LISTINGS'), 'move-listings'); JToolBarHelper::apply('listings.moveListings', 'JTOOLBAR_APPLY'); JToolBarHelper::cancel('listing.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::title(JText::_('COM_JUDIRECTORY_LISTINGS'), 'listings'); $this->totalListings = $this->get('Total'); $this->setDocument(); } if (JUDirectoryHelper::isJoomla3x() && $app->input->get('layout') == 'modal') { $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); } parent::display($tpl); }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory'); $this->addToolBar(); if (JUDirectoryHelper::isJoomla3x()) { $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); } $options = array(); $options[] = JHtml::_('select.option', '1', JText::_('J1')); $options[] = JHtml::_('select.option', '2', JText::_('J2')); $options[] = JHtml::_('select.option', '3', JText::_('J3')); $options[] = JHtml::_('select.option', '4', JText::_('J4')); $options[] = JHtml::_('select.option', '5', JText::_('J5')); $options[] = JHtml::_('select.option', '6', JText::_('J6')); $options[] = JHtml::_('select.option', '7', JText::_('J7')); $options[] = JHtml::_('select.option', '8', JText::_('J8')); $options[] = JHtml::_('select.option', '9', JText::_('J9')); $options[] = JHtml::_('select.option', '10', JText::_('J10')); $this->f_levels = $options; $optionsPublished = array(); $optionsPublished[] = JHtml::_('select.option', '1', JText::_('COM_JUDIRECTORY_PUBLISHED')); $optionsPublished[] = JHtml::_('select.option', '0', JText::_('COM_JUDIRECTORY_UNPUBLISHED')); $this->published_options = $optionsPublished; parent::display($tpl); $this->setDocument(); }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory'); $this->groupCanDoManage = JUDirectoryHelper::checkGroupPermission("comment.edit"); $this->groupCanDoDelete = JUDirectoryHelper::checkGroupPermission("comments.delete"); $this->rootComment = JUDirectoryFrontHelperComment::getRootComment(); foreach ($this->items as &$item) { $this->ordering[$item->parent_id][] = $item->id; } $this->addToolBar(); if (JUDirectoryHelper::isJoomla3x()) { $layout = JFactory::getApplication()->input->get('layout', ''); if ($layout != 'modal') { $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); } } parent::display($tpl); $this->setDocument(); }
protected function getOptions() { $document = JFactory::getDocument(); if (JUDirectoryHelper::isJoomla3x()) { $triggerJqueryChosen = '$("#jform_parent_id").trigger("liszt:updated");'; } else { $triggerJqueryChosen = ''; } $script = ' jQuery(document).ready(function($){ $("#jform_template_id").change(function(){ var objData = {}; objData.value = $(this).val(); $.ajax({ type: "POST", url : "index.php?option=com_judirectory&task=style.changeTemplateId", data: objData }).done(function (data) { $("option","#jform_parent_id").remove(); $("#jform_parent_id").append(data); ' . $triggerJqueryChosen . ' }); }); }); '; $document->addScriptDeclaration($script); $db = JFactory::getDbo(); $options = array(); $styleId = $this->form->getValue('id'); if ($styleId) { $templateId = $this->form->getValue('template_id'); $query = $db->getQuery(true); $query->select('parent_id'); $query->from('#__judirectory_templates'); $query->where('id = ' . (int) $templateId); $db->setQuery($query); $templateParentId = $db->loadResult(); } else { $templateParentId = 0; } $query = $db->getQuery(true); $query->select('*'); $query->select('title AS text'); $query->select('id AS value'); $query->from('#__judirectory_template_styles'); $query->where('template_id = ' . (int) $templateParentId); $query->order('lft ASC'); $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); } for ($i = 0, $n = count($options); $i < $n; $i++) { $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text; } $options = array_merge(parent::getOptions(), $options); return $options; }
public function display($tpl = null) { JHtml::_('behavior.calendar'); $this->addToolBar(); $this->model = $this->getModel(); if ($this->getLayout() == "fields_mapping") { $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDIRECTORY_DEFAULT')); $this->fieldsOption[] = JHTML::_('select.option', 'ignore', JText::_("COM_JUDIRECTORY_IGNORE")); $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDIRECTORY_CORE_FIELDS')); $ignoredFields = array('asset_id', 'introtext', 'fulltext', 'comments'); $coreFields = $this->model->getCoreFields($ignoredFields); foreach ($coreFields as $field) { if (is_object($field)) { $value = $field->id; $label = ucfirst(JText::_($field->caption)); } else { $value = $field; $label = ucfirst(str_replace('_', ' ', $field)); } $this->fieldsOption[] = JHTML::_('select.option', $value, $label); } $extraFields = $this->model->getExtraFields(); foreach ($extraFields as $field) { if (isset($fieldGroups[$field->group_id])) { $fieldGroups[$field->group_id][] = $field; } else { $fieldGroups[$field->group_id] = array($field); } } foreach ($fieldGroups as $groupId => $fields) { $group = JUDirectoryFrontHelperField::getFieldGroupById($groupId); $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', $group->name); foreach ($fields as $field) { $label = ucfirst(JText::_($field->caption)); $this->fieldsOption[] = JHTML::_('select.option', $field->id, $label); } } $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDIRECTORY_OTHER_FIELDS')); $this->fieldsOption[] = JHTML::_('select.option', 'related_listings', JText::_('COM_JUDIRECTORY_FIELD_RELATED_LISTINGS')); } if ($this->getLayout() == 'config') { $this->form = $this->get('Form'); } if ($this->getLayout() == 'review') { if (isset($this->review['config']['default_icon'])) { $this->review['config']['default_icon'] = str_replace(array(JPATH_ROOT . '\\', "\\"), array(JUri::root(), '/'), $this->review['config']['default_icon']); } } $this->isJoomla3x = JUDirectoryHelper::isJoomla3x(); if ($this->getLayout() == "export") { $this->exportForm = $this->get("ExportForm"); } parent::display($tpl); $this->setDocument(); }
protected function loadFormData() { $data = JFactory::getApplication()->getUserState('com_judirectory.edit.criteriagroup.data', array()); if (empty($data)) { $data = $this->getItem(); } if (JUDirectoryHelper::isJoomla3x()) { $this->preprocessData('com_judirectory.criteriagroup', $data); } return $data; }
public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->_prepareDocument(); if (JUDirectoryHelper::isJoomla3x()) { $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); } parent::display($tpl); }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } JHtml::_('behavior.calendar'); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->script = $this->get('Script'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory'); $this->groupCanDoManage = JUDirectoryHelper::checkGroupPermission("globalconfig.save"); $this->isJoomla3x = JUDirectoryHelper::isJoomla3x(); $this->setDocument(); $this->addToolBar(); parent::display($tpl); }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory'); $this->groupCanDoManage = JUDirectoryHelper::checkGroupPermission("tag.edit"); $this->groupCanDoDelete = JUDirectoryHelper::checkGroupPermission("tags.delete"); $this->addToolBar(); if (JUDirectoryHelper::isJoomla3x()) { $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); } parent::display($tpl); $this->setDocument(); }
public function fetchButton($type = 'JUHelp', $name = '', $text = '', $task = '', $list = true) { $i18n_text = JText::_($text); $class = $this->fetchIconClass($name); $doTask = $this->_getCommand($text, $task, $list); if (!JUDirectoryHelper::isJoomla3x()) { $html = "<a href=\"#\" onclick=\"{$doTask}\" class=\"toolbar\">\n"; $html .= "<span class=\"{$class}\">\n"; $html .= "</span>\n"; $html .= "{$i18n_text}\n"; $html .= "</a>\n"; } else { $html = "<button onclick=\"{$doTask}\" class=\"btn btn-small\">\n"; $html .= "<span class=\"{$class}\">\n"; $html .= "</span>\n"; $html .= "{$i18n_text}\n"; $html .= "</button>\n"; } return $html; }
protected function getInput() { $document = JFactory::getDocument(); $document->addStyleSheet(JUri::root() . 'administrator/components/com_judirectory/assets/css/juselect.css'); $document->addScript(JUri::root() . 'administrator/components/com_judirectory/assets/js/juselect.js'); $document->addScript(JUri::root() . "components/com_judirectory/assets/js/jquery.dragsort.min.js"); $scriptv3 = ' setTimeout(function(){ $(".juselect-container").find(".juselect-select").show(); $(".juselect-container").next(".chzn-container").hide(); }, 10);'; $script = 'jQuery(document).ready(function($){ $("#' . $this->id . '").juSelect({ \'selectItems\' : "' . ($this->value ? implode(",", $this->value) : '') . '" }); $(".juselect-list").dragsort({ dragSelector: "li", placeHolderTemplate: \'<li class="placeHolder"></li>\', dragSelectorExclude: \'a\' }); ' . (JUDirectoryHelper::isJoomla3x() ? $scriptv3 : '') . ' });'; $document->addScriptDeclaration($script); $attr = ''; $attr .= !empty($this->class) ? ' class="' . $this->class . '"' : ''; $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : ''; $attr .= $this->multiple ? ' multiple' : ''; $attr .= $this->required ? ' required aria-required="true"' : ''; $attr .= $this->autofocus ? ' autofocus' : ''; if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') { $attr .= ' disabled="disabled"'; } $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : ''; $options = (array) $this->getOptions(); return JHtml::_('select.groupedlist', $options, $this->name, array('id' => $this->id, 'group.id' => 'id', 'list.attr' => $attr, 'list.select' => '')); }
public function display($tpl = null) { if (!JUDirectoryHelper::hasMultiRating()) { JError::raiseError(500, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); return false; } if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory'); $this->groupCanDoManage = JUDirectoryHelper::checkGroupPermission("criteria.edit"); $this->groupCanDoDelete = JUDirectoryHelper::checkGroupPermission("criterias.delete"); $this->addToolBar(); if (JUDirectoryHelper::isJoomla3x()) { $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); } parent::display($tpl); $this->setDocument(); }
JLoader::register('JUDIRViewAdmin', JPATH_ADMINISTRATOR . '/components/com_judirectory/helpers/judirviewadmin.php'); JLoader::register('JUDirectorySearchHelper', JPATH_SITE . '/components/com_judirectory/helpers/search.php'); spl_autoload_register(array('JUDirectoryHelper', 'autoLoadFieldClass')); 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"); }
static function setGlobal($value = 0, $i, $canChange = true, $controller = 'collections', $id = 'cb') { $states = array(0 => array('publish_x.png', 'icon-unpublish', '', $controller . '.setGlobal', JText::_('COM_JUDIRECTORY_NOT_GLOBAL'), JText::_('COM_JUDIRECTORY_TOGGLE_TO_SET_GLOBAL')), 1 => array('tick.png', 'icon-publish', 'active', $controller . '.unsetGlobal', JText::_('COM_JUDIRECTORY_GLOBAL'), JText::_('COM_JUDIRECTORY_TOGGLE_TO_UNSET_GLOBAL'))); $state = JArrayHelper::getValue($states, (int) $value, $states[1]); if (JUDirectoryHelper::isJoomla3x()) { $html = '<i class="' . $state[1] . '"></i>'; if ($canChange) { $html = '<a class="btn btn-micro ' . $state[2] . ' hasTooltip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '<br/>' . $state[5] . '">' . $html . '</a>'; } else { $html = '<a class="btn btn-micro disabled hasTooltip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '<br/>' . $state[5] . '">' . $html . '</a>'; } } else { $html = JHtml::_('image', 'admin/' . $state[0], $state[4], null, true); if ($canChange) { $html = '<a class="hasTip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '::' . $state[5] . '">' . $html . '</a>'; } } return $html; }
* ------------------------------------------------------------------------ * JUDirectory for Joomla 2.5, 3.x * ------------------------------------------------------------------------ * * @copyright Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author JoomUltra Co., Ltd * @website http://www.joomultra.com * @----------------------------------------------------------------------@ */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $title = ""; $class = "control-label col-sm-2"; if ($this->description) { if (JUDirectoryHelper::isJoomla3x()) { $class .= " hasTooltip"; $separator = "<br/>"; } else { $separator = "::"; $class .= " hasTip"; } // If write description as UPPERCASE -> translate it if ($this->description == strtoupper($this->description)) { $description = JText::_($this->description); } else { $description = $this->description; } $title = htmlspecialchars('<strong>' . trim($this->getCaption(), ':') . '</strong>' . $separator . $description, ENT_COMPAT, 'UTF-8'); } $this->addAttribute("class", $class, "label");
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'); } }
public function getInput($fieldValue = null) { if (!$this->isPublished()) { return ""; } if (JUDirectoryHelper::getListingSubmitType($this->listing_id) == 'submit' && $this->canSubmit() || JUDirectoryHelper::getListingSubmitType($this->listing_id) == 'edit' && $this->canEdit()) { $disabled = false; } else { $disabled = true; } $document = JFactory::getDocument(); $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); JText::script('COM_JUDIRECTORY_TOTAL_CATS_OVER_MAXIMUM_N_CATS'); JText::script('COM_JUDIRECTORY_CATEGORY_X_ALREADY_EXIST'); $app = JFactory::getApplication(); // getParams by cat_id if possible if (isset($this->listing) && $this->listing->cat_id) { $params = JUDirectoryHelper::getParams($this->listing->cat_id); } else { $params = JUDirectoryHelper::getParams(null, $this->listing_id); } $db = JFactory::getDbo(); $listingId = $this->listing_id; $listingObject = JUDirectoryHelper::getListingById($listingId); $secondaryCatIds = $secondaryCatIdsStr = ""; // Edit listing, but not valid data -> $fieldValue = user selected categories if ($fieldValue && !empty($fieldValue['main'])) { $categoryId = (int) $fieldValue['main']; if ($fieldValue['secondary']) { $secondaryCatIdsStr = $fieldValue['secondary']; $secondaryCatIds = explode(",", $secondaryCatIdsStr); } $query = $db->getQuery(true); $query->select("c.id, c.parent_id"); $query->from("#__judirectory_categories AS c"); $query->select("field_group.id AS fieldgroup_id, field_group.name AS fieldgroup_name"); $query->join("LEFT", "#__judirectory_fields_groups AS field_group ON (field_group.id = c.fieldgroup_id AND field_group.published = 1)"); $query->where("c.id = " . $categoryId); $db->setQuery($query); $mainCategory = $db->loadObject(); } elseif ($listingId) { $categories = $this->value; foreach ($categories as $category) { if ($category->main == 1) { $mainCategory = $category; $query = $db->getQuery(true); $query->select("field_group.id, field_group.name"); $query->from("#__judirectory_fields_groups AS field_group"); $query->join("", "#__judirectory_categories AS c on c.fieldgroup_id = field_group.id"); $query->where("c.id = " . $mainCategory->id); $query->where("field_group.published = 1"); $db->setQuery($query); $fieldGroup = $db->loadObject(); if (is_object($fieldGroup)) { $mainCategory->fieldgroup_name = $fieldGroup->name; $mainCategory->fieldgroup_id = $fieldGroup->id; } else { $mainCategory->fieldgroup_name = null; $mainCategory->fieldgroup_id = null; } } else { $secondaryCatIds[] = $category->id; } } if ($secondaryCatIds) { $secondaryCatIdsStr = implode(",", $secondaryCatIds); } } elseif ($app->input->getInt('cat_id')) { $categoryId = $app->input->getInt('cat_id'); $mainCategory = JUDirectoryHelper::getCategoryById($categoryId); $query = "SELECT id, name FROM #__judirectory_fields_groups WHERE id= " . $mainCategory->fieldgroup_id . " AND published = 1"; $db->setQuery($query); $fieldGroup = $db->loadObject(); if (is_object($fieldGroup)) { $mainCategory->fieldgroup_name = $fieldGroup->name; $mainCategory->fieldgroup_id = $fieldGroup->id; } else { $mainCategory->fieldgroup_name = null; $mainCategory->fieldgroup_id = null; } } else { $mainCategory = new stdClass(); $mainCategory->id = ''; $mainCategory->parent_id = $rootCat->id; $mainCategory->fieldgroup_name = null; $mainCategory->fieldgroup_id = null; } $document->addStyleSheet(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/core_categories.css"); if (!$disabled) { $document->addScript(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/core_categories.js"); if (JUDirectoryHelper::isJoomla3x()) { $jsIsJoomla3x = 1; } else { $jsIsJoomla3x = 0; } $script = "jQuery(document).ready(function(\$){\n\t\t\t\t\t\t\t\t\$('.category_selection').listingChangeCategory({\n\t\t\t\t\t\t\t\t\tlisting_id: '" . $listingId . "',\n\t\t\t\t\t\t\t\t\tis_joomla_3x: '" . $jsIsJoomla3x . "',\n\t\t\t\t\t\t\t\t\tmain_cat_id: '" . $mainCategory->id . "',\n\t\t\t\t\t\t\t\t\tfieldgroup_id: '" . $mainCategory->fieldgroup_id . "',\n\t\t\t\t\t\t\t\t\tfieldgroup_name : '" . $mainCategory->fieldgroup_name . "',\n\t\t\t\t\t\t\t\t\tmax_cats : " . (int) $params->get("max_cats_per_listing", 0) . "\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});"; $document->addScriptDeclaration($script); } $this->addAttribute("class", "categories", "input"); $this->addAttribute("class", $this->getInputClass(), "input"); $this->setVariable('mainCategory', $mainCategory); $this->setVariable('secondaryCatIds', $secondaryCatIds); $this->setVariable('listingObject', $listingObject); $this->setVariable('disabled', $disabled); $this->setVariable('secondaryCatIdsStr', $secondaryCatIdsStr); $this->setVariable('rootCat', $rootCat); $this->setVariable('params', $params); return $this->fetch('input.php', __CLASS__); }
JHtml::_('formbehavior.chosen', 'select'); $user = JFactory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'field.ordering'; $priority = $listOrder == 'field.priority'; $backend_list_view_ordering = $listOrder == 'field.backend_list_view_ordering'; if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_judirectory&task=fields.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'data-list', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } ?> <script type="text/javascript"> var isJoomla3x = <?php echo JUDirectoryHelper::isJoomla3x() ? 1 : 0; ?> ; Joomla.orderTable = function () { table = document.getElementById("sortTable"); direction = document.getElementById("directionTable"); order = table.options[table.selectedIndex].value; if (order != '<?php echo $listOrder; ?> ') { dirn = 'asc'; } else { dirn = direction.options[direction.selectedIndex].value; } Joomla.tableOrdering(order, dirn, '');
public static function thumb($template, $type = null) { $template = strtolower($template); $basePath = JPATH_SITE . '/components/com_judirectory/templates/' . $template; $baseUrl = JUri::root(true) . '/components/com_judirectory/'; if ($type == 'thumbnail') { $fileList = JFolder::files($basePath . '/'); if (!empty($fileList)) { foreach ($fileList as $fileName) { $explodeArray = explode('.', $fileName); if ($explodeArray[0] == 'template_thumbnail') { $extThumbnail = end($explodeArray); break; } } } if (isset($extThumbnail)) { $thumb = $basePath . '/template_thumbnail.' . $extThumbnail; } if (isset($extThumbnail)) { $preview = $basePath . '/template_thumbnail.' . $extThumbnail; } } elseif ($type == 'preview') { $fileList = JFolder::files($basePath . '/'); if (!empty($fileList)) { foreach ($fileList as $fileName) { $explodeArray = explode('.', $fileName); if ($explodeArray[0] == 'template_preview') { $extPreview = end($explodeArray); break; } } } if (isset($extPreview)) { $thumb = $basePath . '/template_preview.' . $extPreview; } if (isset($extPreview)) { $preview = $basePath . '/template_preview.' . $extPreview; } } else { $fileList = JFolder::files($basePath . '/'); if (!empty($fileList)) { foreach ($fileList as $fileName) { $explodeArray = explode('.', $fileName); if ($explodeArray[0] == 'template_thumbnail') { $extThumbnail = end($explodeArray); } elseif ($explodeArray[0] == 'template_preview') { $extPreview = end($explodeArray); } } } if (isset($extThumbnail)) { $thumb = $basePath . '/template_thumbnail.' . $extThumbnail; } if (isset($extPreview)) { $preview = $basePath . '/template_preview.' . $extPreview; } } $thumbIsImage = false; if (isset($thumb)) { if (@is_array(getimagesize($thumb))) { $thumbIsImage = true; } } $previewIsImage = false; if (isset($preview)) { if (@is_array(getimagesize($preview))) { $previewIsImage = true; } } $html = ''; if (isset($thumb) && $thumbIsImage && file_exists($thumb)) { if (JUDirectoryHelper::isJoomla3x()) { JHtml::_('bootstrap.tooltip'); } JHtml::_('behavior.modal'); if ($type == 'thumbnail') { $thumb = 'components/com_judirectory/templates/' . $template . '/template_thumbnail.' . $extThumbnail; $html = JHtml::_('image', $thumb, JText::_('COM_JUDIRECTORY_PREVIEW'), array('width' => '200px', 'height' => '200px')); } elseif ($type == 'preview') { $thumb = 'components/com_judirectory/templates/' . $template . '/template_preview.' . $extPreview; $html = JHtml::_('image', $thumb, JText::_('COM_JUDIRECTORY_PREVIEW'), array('width' => '200px', 'height' => '200px')); } else { $thumb = 'components/com_judirectory/templates/' . $template . '/template_thumbnail.' . $extThumbnail; $html = JHtml::_('image', $thumb, JText::_('COM_JUDIRECTORY_PREVIEW')); } if (isset($preview) && $previewIsImage && file_exists($preview)) { if ($type == 'thumbnail') { $preview = $baseUrl . '/templates/' . $template . '/template_thumbnail.' . $extThumbnail; } elseif ($type == 'preview') { $preview = $baseUrl . '/templates/' . $template . '/template_preview.' . $extPreview; } else { $preview = $baseUrl . '/templates/' . $template . '/template_preview.' . $extPreview; } if (JUDirectoryHelper::isJoomla3x()) { $html = '<a href="' . $preview . '" class="thumbnail pull-left modal hasTooltip" title="' . JHtml::tooltipText('COM_JUDIRECTORY_CLICK_TO_ENLARGE') . '">' . $html . '</a>'; } else { $html = '<a href="' . $preview . '" class="thumbnail pull-left modal hasTip" title="' . JText::_('COM_JUDIRECTORY_CLICK_TO_ENLARGE') . '" style="width:200px;">' . $html . '</a>'; } } } return $html; }
protected function getInput() { $token = JSession::getFormToken(); $isJoomla3x = JUDirectoryHelper::isJoomla3x(); $script = ' jQuery(document).ready(function($){'; if ($isJoomla3x && $this->checkEditor('codemirror')) { $script .= ' Joomla.editors.instances["jform_php_predefined_values"].on("change", function(){ $("#jform_php_predefined_values").removeData("validPhp"); });'; } else { $script .= ' $("#jform_php_predefined_values").on("change", function(){ $(this).removeData("validPhp"); });'; } $script .= ' $("button.testcode").click(function(){ testPhpCode(false, ""); return false; }); testPhpCode = function(submitOnSuccess, task){ var testCodeBtn = $("button.testcode"); if(testCodeBtn.hasClass("disabled")) { return false; } testCodeBtn.addClass("disabled"); var plugin_id = $("#jform_plugin_id").val();'; if ($isJoomla3x && $this->checkEditor('codemirror')) { $script .= ' var php_code = Joomla.editors.instances["jform_php_predefined_values"].getValue();'; } else { $script .= ' var php_code = $("#jform_php_predefined_values").val();'; } $script .= ' $.ajax({ type: "POST", url: "index.php?option=com_judirectory&task=field.testPhpCode", data: { field_id: ' . (int) $this->form->getValue('id') . ', plugin_id: plugin_id, php_predefined_values: php_code, "' . $token . '": 1 } }) .done(function( data ) { $("code.result").html(data).parent().show(); if(data.indexOf("<b>Fatal error</b>") !== -1) { $("#jform_php_predefined_values").data("validPhp", 0); if(submitOnSuccess) { alert("Predefined PHP values is invalid"); } return false; } else { $("#jform_php_predefined_values").data("validPhp", 1); if(submitOnSuccess) { Joomla.submitbutton(task); } return true; } }) .fail(function(jqXHR, textStatus) { $("#jform_php_predefined_values").data("validPhp", 0); alert("Error " + jqXHR.status + ": " + jqXHR.statusText); }) .always(function() { testCodeBtn.removeClass("disabled"); }); } });'; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); $editor = JFactory::getEditor('codemirror'); $html = '<button class="btn testcode"><i class="icon-ok"></i> Test code</button>'; $html .= '<div class="hide" style="clear: both; max-width: 100%; max-height: 300px; overflow: auto; margin: 10px 0;"><code class="result pull-left"></code></div>'; $html .= '<div style="clear: both; color: #999; font-family: Monaco,Menlo,Consolas,\'Courier New\',monospace; margin-top: 10px;">'; $html .= '<div>// Remember to not include the <b><?php</b> and <b>?></b> tags.</div>'; $html .= '<div>// To highlight code, put the first line as: <b>//<?php</b></div>'; $html .= '</div>'; if ($isJoomla3x && $this->checkEditor('codemirror')) { $html .= $editor->display($this->name, htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), $this->element['width'], $this->element['height'], $this->element['cols'], $this->element['rows'], false, $this->id); } else { $html .= '<textarea style="'; if ($this->element['width']) { $html .= 'width: ' . $this->element['width'] . 'px;'; } if ($this->element['height']) { $html .= 'height: ' . $this->element['height'] . 'px;'; } $html .= '"'; if ($this->element['cols']) { $html .= ' cols="' . $this->element['cols'] . '"'; } if ($this->element['rows']) { $html .= ' rows="' . $this->element['rows'] . '"'; } $html .= ' name="' . $this->name . '"'; $html .= ' id="' . $this->id . '"'; $html .= '>' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '</textarea>'; } $html .= '<div style="clear: both; font-family: Monaco,Menlo,Consolas,\'Courier New\',monospace;">'; $html .= '<span style="color: #999;">// End function - return appropriate value</span>'; $html .= '</div>'; return $html; }
protected function _prepareDocument() { $document = JFactory::getDocument(); $uri = clone JUri::getInstance(); $domain = $uri->toString(array('scheme', 'host', 'port')); $canonicalLink = $domain . JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->item->id, $this->_layout), false); JUDirectoryFrontHelper::setCanonical($canonicalLink); $document->addCustomTag('<meta property="og:title" content="' . htmlspecialchars(strip_tags($this->item->title), ENT_COMPAT, 'UTF-8') . '" />'); $document->addCustomTag('<meta property="og:type" content="website" />'); $listingImage = JUDirectoryHelper::getListingImage($this->item->image); if ($listingImage) { $document->addCustomTag('<meta property="og:image" content="' . $listingImage . '" />'); } $document->addCustomTag('<meta property="og:url" content="' . $canonicalLink . '" />'); $document->addCustomTag('<meta property="og:description" content="' . htmlspecialchars(strip_tags($this->item->description), ENT_COMPAT, 'UTF-8') . '" />'); $conf = JFactory::getConfig(); if (JUDirectoryHelper::isJoomla3x()) { $siteName = $conf->get('sitename'); } else { $siteName = $conf->getValue('config.sitename'); } $document->addCustomTag('<meta property="og:site_name" content="' . htmlspecialchars(strip_tags($siteName), ENT_COMPAT, 'UTF-8') . '" />'); JUDirectoryFrontHelperSeo::seo($this); }
"> <?php echo $item->title; ?> </a> <?php } else { ?> <?php echo $item->title; ?> <?php } ?> <p class="<?php echo JUDirectoryHelper::isJoomla3x() ? "small" : "smallsub"; ?> "><?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> </p> </td> <td> <?php echo JUDirectoryHelper::generateCategoryPath($item->category_id, " > ", true, true); ?> </td> <td> <?php echo JHtml::_('jgrid.published', $item->published, $i, 'listings.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
protected function loadFormData() { $data = JFactory::getApplication()->getUserState('com_judirectory.edit.category.data', array()); if (empty($data)) { $data = $this->getItem(); } $params = JUDirectoryHelper::getParams($data->id); if (isset($data->config_params) && $data->config_params) { $params->loadArray($data->config_params); $data->config_params = $params->toArray(); } if (JUDirectoryHelper::isJoomla3x()) { $this->preprocessData('com_judirectory.category', $data); } return $data; }