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(); }
<?php $extraFields = $this->model->getExtraFields(); $fieldGroups = array(); foreach ($extraFields as $field) { if (!$field->canExport()) { continue; } if (isset($fieldGroups[$field->group_id])) { $fieldGroups[$field->group_id][] = $field; } else { $fieldGroups[$field->group_id] = array($field); } } if (!empty($fieldGroups)) { foreach ($fieldGroups as $groupId => $fields) { $group = JUDirectoryFrontHelperField::getFieldGroupById($groupId); echo JHtml::_('tabs.panel', $group->name, "fieldgroup-{$group->id}"); ?> <table class="table table-striped"> <thead> <tr> <th width="1%"> <input type="checkbox" id="<?php echo $group->id; ?> " sub-checkbox="group_<?php echo $group->id; ?> " class="field" title="<?php echo JText::_('COM_JUDIRECTORY_CHECK_ALL');
public function saveCategoryPrepareFieldGroup($pk, $newParentObject, $table, &$data) { $app = JFactory::getApplication(); if ($pk > 0) { if ($data['selected_fieldgroup'] == -1) { if ($table->selected_fieldgroup == -1) { if ($table->parent_id == $data['parent_id']) { $data['fieldgroup_id'] = $table->fieldgroup_id; } else { $newFieldGroupId = $newParentObject->fieldgroup_id; if ($table->fieldgroup_id == $newFieldGroupId) { $data['fieldgroup_id'] = $table->fieldgroup_id; } else { if ($data['changeFieldGroupAction'] == 1) { $data['fieldgroup_id'] = $table->fieldgroup_id; $data['selected_fieldgroup'] = $table->fieldgroup_id; $fieldGroupObject = JUDirectoryFrontHelperField::getFieldGroupById($table->fieldgroup_id); $app->enqueueMessage(JText::sprintf('COM_JUDIRECTORY_INHERITED_FIELD_GROUP_HAS_BEEN_CHANGED_TO_X', $fieldGroupObject->name ? $fieldGroupObject->name : JText::_("COM_JUDIRECTORY_NONE")), 'Notice'); } else { $data['fieldgroup_id'] = $newParentObject->fieldgroup_id; } } } } else { $data['fieldgroup_id'] = $newParentObject->fieldgroup_id; } } else { $data['fieldgroup_id'] = $data['selected_fieldgroup']; } } else { if ($data['selected_fieldgroup'] == -1) { $data['fieldgroup_id'] = $newParentObject->fieldgroup_id; } else { $data['fieldgroup_id'] = $data['selected_fieldgroup']; } } }
public function canView($options = array()) { $storeId = md5(__METHOD__ . "::" . $this->listing_id . "::" . $this->id . "::" . serialize($options)); if (!isset(self::$cache[$storeId])) { if (!$this->isPublished()) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } $app = JFactory::getApplication(); $languageFilter = $app->getLanguageFilter(); if ($languageFilter) { $languageTag = JFactory::getLanguage()->getTag(); if ($this->language != $languageTag && $this->language != '*' && $this->language != '') { self::$cache[$storeId] = false; return self::$cache[$storeId]; } } if ($this->listing_id) { $listing_display_params = JUDirectoryFrontHelperListing::getListingDisplayParams($this->listing_id); $listing_display_fields = $listing_display_params->get('fields'); } $options = (array) $options; $field_name = $this->field_name ? $this->field_name : $this->id; if ($this->isDetailsView($options)) { if (isset($listing_display_fields->{$field_name}) && isset($listing_display_fields->{$field_name}->details_view)) { if (!$listing_display_fields->{$field_name}->details_view) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } } elseif (!$this->details_view) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } } else { if (isset($listing_display_fields->{$field_name}) && isset($listing_display_fields->{$field_name}->list_view)) { if (!$listing_display_fields->{$field_name}->list_view) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } } elseif (!$this->list_view) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } } if (isset($this->listing) && $this->listing->cat_id) { $params = JUDirectoryHelper::getParams($this->listing->cat_id); } else { $params = JUDirectoryHelper::getParams(null, $this->listing_id); } $show_empty_field = $params->get('show_empty_field', 0); if ($this->listing_id && !$show_empty_field) { $field_value = $this->value; if (is_null($field_value)) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } if (is_string($field_value) && trim($field_value) === '') { self::$cache[$storeId] = false; return self::$cache[$storeId]; } if (is_array($field_value) && count($field_value) == 0) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } } $user = JFactory::getUser(); if ($user) { $viewLevels = JAccess::getAuthorisedViewLevels($user->id); $fieldGroupObj = JUDirectoryFrontHelperField::getFieldGroupById($this->group_id); if (!in_array($fieldGroupObj->access, $viewLevels)) { self::$cache[$storeId] = false; return self::$cache[$storeId]; } else { if (in_array($this->access, $viewLevels)) { self::$cache[$storeId] = true; return self::$cache[$storeId]; } } } self::$cache[$storeId] = false; return self::$cache[$storeId]; } return self::$cache[$storeId]; }