protected function _prepareData() { $this->order_name_array = JUDirectoryFrontHelperField::getFrontEndOrdering(); $this->order_dir_array = JUDirectoryFrontHelperField::getFrontEndDirection(); $this->listing_order = $this->escape($this->state->get('list.ordering')); $this->listing_dir = $this->escape($this->state->get('list.direction', 'ASC')); $this->listing_columns = (int) $this->params->get('listing_columns', 2); if (!is_numeric($this->listing_columns) || $this->listing_columns <= 0) { $this->listing_columns = 1; } $this->listing_bootstrap_columns = JUDirectoryFrontHelper::getBootstrapColumns($this->listing_columns); $this->listing_row_class = htmlspecialchars($this->params->get('listing_row_class', '')); $this->listing_column_class = htmlspecialchars($this->params->get('listing_column_class', '')); $this->load_bootstrap = $this->params->get('load_bootstrap', 2); if ($this->load_bootstrap) { $this->listing_bootstrap_columns = JUDirectoryFrontHelper::getBootstrapColumns($this->listing_columns); } $this->allow_user_select_view_mode = $this->params->get('allow_user_select_view_mode', 1); if ($this->allow_user_select_view_mode && isset($_COOKIE['judir-view-mode']) && !empty($_COOKIE['judir-view-mode'])) { $viewMode = $_COOKIE['judir-view-mode'] == 'judir-view-grid' ? 2 : 1; } else { $viewMode = $this->params->get('default_view_mode', 2); } $this->view_mode = $viewMode; }
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; }
protected function getInput() { if ($this->form->getValue("id") && $this->form->getValue("plugin_id")) { $fieldObj = JUDirectoryFrontHelperField::getField($this->form->getValue("id")); $html = $fieldObj->getPredefinedValuesHtml(); } else { $html = '<span class="readonly">' . JText::_('COM_JUDIRECTORY_NO_VALUE') . '</span>'; } return $html; }
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(); }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->model = $this->getModel(); $this->app = JFactory::getApplication(); $cat_id = $this->item->cat_id ? $this->item->cat_id : $this->app->input->get('cat_id'); $this->params = JUDirectoryHelper::getParams(null, $this->item->id); if ($cat_id == JUDirectoryFrontHelperCategory::getRootCategory()->id && !$this->params->get('allow_add_listing_to_root', 0)) { JError::raiseError(500, JText::_('COM_JUDIRECTORY_CAN_NOT_ADD_LISTING_TO_ROOT_CATEGORY')); return false; } if ($tempListing = JUDirectoryHelper::getTempListing($this->item->id)) { $editPendingListingLink = '<a href="index.php?option=com_judirectory&task=document.edit&approve=1&id=' . $tempListing->id . '">' . $tempListing->title . '</a>'; JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_THIS_LISTING_HAS_PENDING_LISTING_X_PLEASE_APPROVE_PENDING_LISTING_FIRST', $editPendingListingLink)); } if ($this->item->approved < 0) { $oriListingId = abs($this->item->approved); $oriListingObj = JUDirectoryHelper::getListingById($oriListingId); $editOriDocLink = '<a href="index.php?option=com_judirectory&task=document.edit&id=' . $oriListingId . '">' . $oriListingObj->title . '</a>'; JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_ORIGINAL_LISTING_X', $editOriDocLink)); } $this->script = $this->get('Script'); $this->plugins = $this->get('Plugins'); $this->fieldLocations = $this->get('FieldLocations'); $this->fieldsetDetails = $this->model->getCoreFields('details'); $this->fieldsetPublishing = $this->model->getCoreFields('publishing'); $this->fieldsetTemplateStyleAndLayout = $this->model->getCoreFields('template_style'); $this->fieldsetMetadata = $this->model->getCoreFields('metadata'); $this->fieldCatid = JUDirectoryFrontHelperField::getField('cat_id', $this->item); $this->fieldGallery = $this->get('GalleryField'); $this->extraFields = $this->get('ExtraFields'); $this->fieldsData = $this->app->getUserState("com_judirectory.edit.listing.fieldsdata", array()); $this->relatedListings = $this->get('RelatedListings'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory', 'category', $this->item->cat_id); $this->addToolBar(); $this->setDocument(); parent::display($tpl); }
public static function getListingsSearch($searchword, $state, $cat_id = null) { $searchword = trim($searchword); $app = JFactory::getApplication(); $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); $levels_str = implode(',', $levels); $db = JFactory::getDbo(); $nullDate = $db->getNullDate(); $nowDate = JFactory::getDate()->toSql(); $query = $db->getQuery(true); $listOrder = $state->get('list.ordering'); $listDirn = $state->get('list.direction'); if ($app->isAdmin()) { $query->SELECT('listing.id, listing.title, listing.alias, listing.published, listing.publish_up, listing.publish_down, listing.checked_out, listing.checked_out_time, listing.featured, listing.access, listing.created_by, listing.language'); $query->SELECT('c.id AS category_id, c.title AS category_title'); $where_str = $app->isSite() ? ' AND cm.published = 1' : ''; $query->SELECT('(SELECT COUNT(*) FROM #__judirectory_comments AS cm WHERE (cm.listing_id = listing.id AND cm.approved = 1' . $where_str . ')) AS comments'); $query->SELECT('(SELECT COUNT(*) FROM #__judirectory_reports AS r WHERE r.item_id = listing.id AND r.type="listing") AS reports'); $where_str = $app->isSite() ? ' AND s.published = 1' : ''; $query->SELECT('(SELECT COUNT(*) FROM #__judirectory_subscriptions AS s WHERE s.item_id = listing.id AND s.type="listing"' . $where_str . ') AS subscriptions'); $query->SELECT('ua.name AS created_by_name'); $query->JOIN("LEFT", "#__users AS ua ON listing.created_by = ua.id"); $query->SELECT('ua3.name AS checked_out_name'); $query->JOIN("LEFT", "#__users AS ua3 ON listing.checked_out = ua3.id"); $query->SELECT("vl.title AS access_title"); $query->JOIN("LEFT", "#__viewlevels AS vl ON listing.access = vl.id"); } else { $query->SELECT('listing.*'); if ($app->isSite()) { JUDirectoryFrontHelper::optimizeListListingQuery($query); } } $query->FROM('#__judirectory_listings AS listing'); $query->JOIN('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id'); $query->JOIN('', '#__judirectory_categories AS c ON (c.id = listingxref.cat_id)'); $field_query = $db->getQuery(true); $field_query->select("field.*"); $field_query->from("#__judirectory_fields AS field"); $field_query->select("plg.folder"); $field_query->join("", "#__judirectory_plugins AS plg ON field.plugin_id = plg.id"); $field_query->join("", "#__judirectory_fields_groups AS field_group ON field_group.id = field.group_id"); $field_query->join("", "#__judirectory_categories AS c2 ON (c2.fieldgroup_id = field_group.id OR field.group_id = 1)"); if ($app->isSite()) { if (is_array($cat_id)) { $cat_id = (array) $cat_id; $field_query->where('(c2.id IN (' . implode(",", $cat_id) . ') OR field.group_id = 1)'); } elseif ($cat_id) { $cat_id = (int) $cat_id; $field_query->where('(c2.id = ' . $cat_id . ' OR field.group_id = 1)'); } $field_query->where('c2.published = 1'); $field_query->where('c2.publish_up <= ' . $db->quote($nowDate)); $field_query->where('(c2.publish_down = ' . $db->quote($nullDate) . ' OR c2.publish_down > ' . $db->quote($nowDate) . ')'); } $field_query->where('field.simple_search = 1'); $field_query->where('field.published = 1'); $field_query->where('field.publish_up <= ' . $db->quote($nowDate)); $field_query->where('(field.publish_down = ' . $db->quote($nullDate) . ' OR field.publish_down > ' . $db->quote($nowDate) . ')'); $field_query->where('(field.field_name != "cat_id"'); $field_query->where("field_group.published = 1)"); $field_query->group('field.id'); $db->setQuery($field_query); $fields = $db->loadObjectList(); $where = array(); if ($fields) { foreach ($fields as $field) { if ($searchword) { $fieldClass = JUDirectoryFrontHelperField::getField($field); $fieldClass->onSimpleSearch($query, $where, $searchword); } } if (!empty($where)) { $query->WHERE("(" . implode(" OR ", $where) . ")"); } } $app = JFactory::getApplication(); if ($app->isAdmin()) { $published = $state->get('filter.state'); if (is_numeric($published)) { $query->WHERE('listing.published = ' . (int) $published); } $cat_id = $state->get('filter.category'); if (is_numeric($cat_id)) { $query->WHERE('listingxref.cat_id = ' . (int) $cat_id); } $access_level = $state->get('filter.access'); if (is_numeric($access_level) && $access_level != 0) { $query->WHERE('listing.access = ' . (int) $access_level); } $language = $state->get('filter.language'); if ($language) { $query->where('listing.language = ' . $db->quote($language)); } } else { $query->where('listing.published = 1'); if ($cat_id) { if (is_array($cat_id)) { $cat_id = (array) $cat_id; $query->where('c.id IN (' . implode(",", $cat_id) . ')'); } elseif ($cat_id) { $cat_id = (int) $cat_id; $query->where('c.id = ' . $cat_id); } } $query->where('listing.publish_up <= ' . $db->quote($nowDate)); $query->where('(listing.publish_down = ' . $db->quote($nullDate) . ' OR listing.publish_down > ' . $db->quote($nowDate) . ')'); if ($user->get('guest')) { $query->where('listing.access IN (' . $levels_str . ')'); } else { $query->where('(listing.access IN (' . $levels_str . ') OR (listing.created_by = ' . $user->id . '))'); } } $query->where('listing.approved = 1'); JUDirectoryFrontHelperField::appendFieldOrderingPriority($query, null, $listOrder, $listDirn); $query->group('listing.id'); return $query; }
protected function getListQuery() { $app = JFactory::getApplication(); $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $categoryId = $this->getState('category.id', $rootCategory->id); $getAllNestedCategories = $app->input->getInt('all', 0); $catFilter = true; if ($categoryId == 1 && $getAllNestedCategories == 1) { $catFilter = false; } if ($catFilter) { $categoryIdArray = array(); if ($getAllNestedCategories == 1) { $nestedCategories = JUDirectoryFrontHelperCategory::getCategoriesRecursive($categoryId, true, true); if (count($nestedCategories) > 0) { foreach ($nestedCategories as $categoryObj) { $categoryIdArray[] = $categoryObj->id; } } } array_unshift($categoryIdArray, $categoryId); $categoryString = implode(",", $categoryIdArray); } $ordering = $this->getState('list.ordering', ''); $direction = $this->getState('list.direction', 'ASC'); $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); $levelsStr = implode(',', $levels); $db = JFactory::getDbo(); $nullDate = $db->getNullDate(); $nowDate = JFactory::getDate()->toSql(); $query = $db->getQuery(true); $query->select('listing.*'); $query->from('#__judirectory_listings AS listing'); JUDirectoryFrontHelper::optimizeListListingQuery($query); if ($catFilter) { $query->join('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id'); $query->join('', '#__judirectory_categories AS c ON c.id = listingxref.cat_id'); $query->where('c.id IN(' . $categoryString . ')'); $query->group('listing.id'); } $query->where('listing.approved = 1'); $query->where('listing.published = 1'); $query->where('(listing.publish_up = ' . $db->quote($nullDate) . ' OR listing.publish_up <= ' . $db->quote($nowDate) . ')'); $query->where('(listing.publish_down = ' . $db->quote($nullDate) . ' OR listing.publish_down >= ' . $db->quote($nowDate) . ')'); if ($user->get('guest')) { $query->where('listing.access IN (' . $levelsStr . ')'); } else { $query->where('(listing.access IN (' . $levelsStr . ') OR (listing.created_by = ' . $user->id . '))'); } $query->where('listing.featured = 1'); $app = JFactory::getApplication(); $tag = JFactory::getLanguage()->getTag(); if ($app->getLanguageFilter()) { $query->where('listing.language IN (' . $db->quote($tag) . ',' . $db->quote('*') . ',' . $db->quote('') . ')'); } $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory(); JUDirectoryFrontHelperField::appendFieldOrderingPriority($query, $categoryRoot->id, $ordering, $direction); return $query; }
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]; }
</th> <th class="center"> <p class="text-center"><?php echo JText::_("COM_JUDIRECTORY_REMOVE"); ?> </p> </th> </tr> </thead> <tbody id="table-collection-items-tbody"> <?php if (count($this->items)) { $i = 0; foreach ($this->items as $item) { $specialFields = JUDirectoryFrontHelperField::getFields($item, null, array("description", "created", "title", "cat_id", "icon")); ?> <tr id="coll-item-row-<?php echo $i; ?> "> <td> <?php $imageField = $specialFields['icon']; if (isset($imageFieldd) & $imageFieldld->canView()) { ?> <div class="collection-item-icon"> <?php echo $imageFieldeld->getOutput(array('view' => "list")); ?> </div>
if ($this->item->label_updated) { $item_class_arr[] = "updated"; } if ($this->item->label_hot) { $item_class_arr[] = "hot"; } if ($this->item->label_featured) { $item_class_arr[] = "featured"; } $item_class_arr[] = $this->listing_column_class ? $this->listing_column_class : ""; $item_class_arr[] = $this->view_mode == 2 ? "col-md-" . $this->listing_bootstrap_columns[$this->col_counter - 1] : "col-md-12"; $item_class = implode(" ", $item_class_arr); $listing_grid_col = $this->listing_bootstrap_columns[$this->col_counter - 1]; // Get all list view fields $additionFields = array(); $fields = JUDirectoryFrontHelperField::getFields($this->item, 1, array(), array(), $additionFields); // Ignore these fields from summary fields $ignoredFields = array("title", "description", "image", "publish_up", "created_by", "featured", "cat_id", "tags", "introtext"); $summaryFields = array(); foreach ($fields as $fieldKey => $field) { if (!in_array($fieldKey) && is_object($field) && $field->canView(array("view" => "list"))) { $summaryFields[] = $field; //print_r($field); } } ?> <div class="<?php echo $item_class; ?> " data-list-class="col-md-12" data-grid-class="col-md-<?php echo $listing_grid_col;
public function cancel($key = null) { JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $listing_id = $app->input->getInt('id', 0); if ($listing_id) { $listingObject = JUDirectoryHelper::getListingById($listing_id); $cat_id = $listingObject->cat_id; } else { $fieldCategory = JUDirectoryFrontHelperField::getField('cat_id'); $fieldsData = $app->input->post->get('fields', array(), 'array'); $cat_id = $fieldsData[$fieldCategory->id]['main']; } if (!$cat_id) { $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $cat_id = $rootCategory->id; } $context = $this->option . ".edit." . $this->context; $app->setUserState($context . '.data', null); $app->setUserState($context . '.fieldsdata', null); $app->setUserState($context . '.related_listings', null); if ($listing_id) { $db = JFactory::getDbo(); $query = "SELECT cat_id FROM #__judirectory_listings_xref WHERE listing_id = {$listing_id} AND main = 1"; $db->setQuery($query); $cat_id = $db->loadResult(); } parent::cancel($key = null); if ($this->view_list == "pendinglistings") { $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); } else { $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id={$cat_id}"); } }
<?php break; case "published": if ($item->main) { echo JHtml::_('jgrid.published', $item->published, $i, 'listings.', $canChange, 'listing', $item->publish_up, $item->publish_down); } else { echo JHtml::_('jgrid.published', $item->published, $i, 'listings.', false, 'listing', $item->publish_up, $item->publish_down); } break; case "featured": if ($item->main) { echo JHtml::_('judirectoryadministrator.featured', $item->featured, $i, $canChange, 'listings', 'listing'); } else { echo JHtml::_('judirectoryadministrator.featured', $item->featured, $i, false); } break; default: $field = JUDirectoryFrontHelperField::getField($field, $item->id); echo $field->getBackendOutput(); break; } echo '</td>'; } ?> </tr> <?php } ?> </tbody> </table> </div>
<?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');
JUDirectoryFrontHelperLanguage::loadLanguageFile("com_judirectory.custom"); if (JUDirectoryHelper::isJoomla3x()) { JHtml::_('script', 'system/core.js', false, true); } $app = JFactory::getApplication(); $task = $app->input->get('task'); switch ($task) { case 'captcha': $namespace = $app->input->getString('captcha_namespace', ''); JUDirectoryFrontHelperCaptcha::captchaSecurityImages($namespace); exit; break; case 'rawdata': $field_id = $app->input->getInt('field_id', 0); $listing_id = $app->input->getInt('listing_id', 0); $fieldObj = JUDirectoryFrontHelperField::getField($field_id, $listing_id); JUDirectoryHelper::obCleanData(); $fieldObj->getRawData(); exit; break; case 'cron': JUDirectoryFrontHelperMail::sendMailq(); exit; break; default: $controller = JControllerLegacy::getInstance('judirectory'); $controller->execute($app->input->get('task')); $controller->redirect(); break; } $params = JUDirectoryHelper::getParams();
protected function getListQuery() { $cat_id = $this->state->get('list.cat_id'); $listOrder = $this->state->get('list.ordering'); $listDirn = $this->state->get('list.direction'); $db = JFactory::getDbo(); $query = $db->getQuery(true); if ($this->fields) { $query->SELECT('listing.*'); $query->FROM('#__judirectory_listings AS listing'); $query->SELECT('listingxref.main'); $query->JOIN("", "#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id"); $query->JOIN("", "#__judirectory_categories AS c ON c.id = listingxref.cat_id"); $query->SELECT('ua3.name AS checked_out_name'); $query->JOIN("LEFT", "#__users AS ua3 ON listing.checked_out = ua3.id"); $search = $this->state->get('filter.search'); if (!empty($search)) { $search = '%' . $db->escape($search, true) . '%'; $where = "(listingxref.cat_id = {$cat_id} AND listing.title LIKE '{$search}')"; } else { $where = "listingxref.cat_id = {$cat_id}"; } $query->WHERE($where); $query->WHERE('listing.approved > 0'); JUDirectoryFrontHelperField::appendFieldOrderingPriority($query, $cat_id, $listOrder, $listDirn); $query->group('listing.id'); return $query; } return null; }
public function getExportData($exportColumns, $filter) { $exportData = array(); $start = 0; $limit = 0; if (isset($filter['csv_limit_export']) && $filter['csv_limit_export']) { if (strpos($filter['csv_limit_export'], ',') !== false) { list($start, $limit) = explode(',', $filter['csv_limit_export']); } else { $limit = (int) $filter['csv_limit_export']; } } if (JUDirectoryHelper::hasCSVPlugin()) { $JUDirectoryCsv = new JUDirectoryCSV($this); $listings = $JUDirectoryCsv->getListings($exportColumns, $filter, $start, $limit); } if (!empty($listings)) { foreach ($listings as $listing) { $data = array(); foreach ($exportColumns as $exportColumn) { if (is_numeric($exportColumn)) { $field = JUDirectoryFrontHelperField::getField($exportColumn, $listing); if ($field && $field->canExport()) { $data[$field->getCaption(true) . ' [' . $field->id . ']'] = $field->onExport(); } } elseif (isset($listing->{$exportColumn})) { $data[$exportColumn] = $listing->{$exportColumn}; } } if (in_array('related_listings', $exportColumns)) { $data['related_listings'] = $listing->related_listings; } $exportData[] = $data; } } $columns = array_keys($exportData[0]); array_unshift($exportData, $columns); return $exportData; }
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 save($data) { $app = JFactory::getApplication(); $jform = $app->input->post->get('jform', array(), 'array'); $data['params'] = isset($jform['params']) ? $jform['params'] : null; $table = $this->getTable(); if ($table->load($data['id']) && $table->plugin_id == $data['plugin_id']) { $fieldClass = JUDirectoryFrontHelperField::getField($data['id']); $data = $fieldClass->onSave($data); $data['params'] = json_encode($data['params']); } else { $data['params'] = ""; } if (parent::save($data)) { $table = $this->getTable(); $table->reorder("group_id = " . (int) $data['group_id']); $table->repriority(); $table->reblvorder(); return true; } return false; }
?> </th> <th style="width:5%" class="center"> <?php echo JText::_('COM_JUDIRECTORY_FIELD_ID'); ?> </th> </tr> </thead> <tbody> <?php if (is_array($this->items) && count($this->items)) { foreach ($this->items as $i => $item) { $this->item = $item; $fields = JUDirectoryFrontHelperField::getFields($item, null); ?> <tr> <td class="center"> <input type="checkbox" class="judir-cb" name="cid[]" value="<?php echo $item->id; ?> " id="judir-cb-<?php echo $i; ?> "/> </td> <td> <?php $user = JFactory::getUser();
public static function getListingDisplayParams($listing_id) { if (!$listing_id) { return null; } $storeId = md5(__METHOD__ . "::{$listing_id}"); if (!isset(self::$cache[$storeId])) { $params = JUDirectoryHelper::getParams(null, $listing_id); $global_display_params = $params->get('display_params'); $global_listing_display_object = isset($global_display_params->listing) ? $global_display_params->listing : array(); $global_listing_display_params = new JRegistry($global_listing_display_object); $listingObj = JUDirectoryHelper::getListingById($listing_id); $listing_params = $listingObj->params; if ($listing_params) { $listing_params = json_decode($listing_params); $listing_display_params = $listing_params->display_params; if ($listing_display_params) { $global_listing_display_params = JUDirectoryFrontHelperField::mergeFieldOptions($global_listing_display_params->toObject(), $listing_display_params); unset($listing_display_params->fields); foreach ($listing_display_params as $option => $value) { if ($value == '-2') { unset($listing_display_params->{$option}); } } $global_listing_display_params->loadObject($listing_display_params); } } self::$cache[$storeId] = $global_listing_display_params; } return self::$cache[$storeId]; }
public static function getAdvSearchFields() { $app = JFactory::getApplication(); $db = JFactory::getDbo(); $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); $query = $db->getQuery(true); $query->select('plg.folder, field.*, field_group.name AS filed_group_name'); $query->from('#__judirectory_fields AS field'); $query->join('', '#__judirectory_plugins AS plg ON field.plugin_id = plg.id'); $query->join('', '#__judirectory_fields_groups AS field_group ON field.group_id = field_group.id'); if ($app->isSite()) { $query->where('field.advanced_search = 1'); } $query->where('field_group.published = 1'); $query->where('field.published = 1'); $query->where('field.field_name != "cat_id"'); $query->where('field.publish_up <= ' . $nowDate); $query->where('(field.publish_down = ' . $nullDate . ' OR field.publish_down > ' . $nowDate . ')'); $query->order('field.group_id, field.ordering'); $db->setQuery($query); $fields = $db->loadObjectList(); if ($fields) { $fieldGroups = array(); foreach ($fields as $field) { if (!isset($fieldGroups[$field->group_id])) { $fieldGroups[$field->group_id] = new stdClass(); $fieldGroups[$field->group_id]->name = $field->filed_group_name; $fieldGroups[$field->group_id]->id = $field->group_id; $fieldGroups[$field->group_id]->fields = array(); } $fieldGroups[$field->group_id]->fields[] = JUDirectoryFrontHelperField::getField($field); } return $fieldGroups; } return null; }
public static function appendFieldOrderingPriority(&$query = null, $catIds = null, $ordering = null, $direction = null) { if (!$catIds) { $catIds = JUDirectoryFrontHelperCategory::getRootCategory()->id; } $storeId = md5(__METHOD__ . "::" . serialize($catIds) . "::{$ordering}"); if (!isset(self::$cache[$storeId])) { $db = JFactory::getDbo(); $nullDate = $db->getNullDate(); $nowDate = JFactory::getDate()->toSql(); $priority_query = $db->getQuery(true); $priority_query->select("field.*"); $priority_query->from("#__judirectory_fields AS field"); $priority_query->select("plg.folder"); $priority_query->join("", "#__judirectory_plugins AS plg ON field.plugin_id = plg.id "); $priority_query->join("", "#__judirectory_fields_groups AS field_group ON field.group_id = field_group.id"); $priority_query->join("", "#__judirectory_categories AS c ON (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.fieldgroup_id = field_group.id AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.published = 1 AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.publish_up <= " . $db->quote($nowDate) . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(c.publish_down = " . $db->quote($nullDate) . " OR c.publish_down > " . $db->quote($nowDate) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) OR field.group_id = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t )"); $where = array(); $where[] = 'field.published = 1'; $where[] = 'field.publish_up <= ' . $db->quote($nowDate); $where[] = '(field.publish_down = ' . $db->quote($nullDate) . ' OR field.publish_down > ' . $db->quote($nowDate) . ')'; if (is_array($catIds)) { $where[] = "(c.id IN (" . implode(",", $catIds) . ") OR field.group_id = 1)"; } else { $where[] = "(c.id = {$catIds} OR field.group_id = 1)"; } $where[] = 'field.allow_priority = 1'; $where[] = 'field_group.published = 1'; $priority_query->where("(" . implode(" AND ", $where) . ")", "OR"); if ($ordering) { $where = array(); $where[] = "field.id = '{$ordering}'"; $app = JFactory::getApplication(); if ($app->isSite()) { $where[] = "field.frontend_ordering = 1"; } else { $where[] = "field.backend_list_view >= 1"; } $where[] = "field.published = 1"; $where[] = "field.publish_up <= " . $db->quote($nowDate); $where[] = "(field.publish_down = " . $db->quote($nullDate) . " OR field.publish_down >= " . $db->quote($nowDate) . ")"; $priority_query->where("(" . implode(" AND ", $where) . ")", "OR"); } $priority_query->group('field.id'); $priority_query->order('field.priority ASC'); $db->setQuery($priority_query); self::$cache[$storeId] = $db->loadObjectList(); } $priorityFields = self::$cache[$storeId]; $priority_order = array(); $_ordering = ""; foreach ($priorityFields as $priorityField) { $field = JUDirectoryFrontHelperField::getField($priorityField); if ($field) { $priority = $field->orderingPriority($query); if ($ordering && $field->id == $ordering && $priority) { $_ordering = $priority['ordering']; } elseif ($priority) { $priority_order[] = $priority['ordering'] . ' ' . $priority['direction']; } } } $priority_str = ""; if ($priority_order) { $priority_str = implode(", ", $priority_order); } if ($_ordering) { $ordering_str = $_ordering . " " . $direction; if ($priority_str) { $priority_str = $ordering_str . ", " . $priority_str; } } if ($priority_str) { $query->order($priority_str); } return $priority_str; }
protected function getListQuery() { $tagId = (int) $this->getState('tag.id'); $ordering = $this->getState('list.ordering', ''); $direction = $this->getState('list.direction', 'ASC'); $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); $levelsStr = implode(',', $levels); $db = JFactory::getDbo(); $nullDate = $db->getNullDate(); $nowDate = JFactory::getDate()->toSql(); $query = $db->getQuery(true); $query->select('listing.*'); $query->from('#__judirectory_listings AS listing'); JUDirectoryFrontHelper::optimizeListListingQuery($query); $query->join('', '#__judirectory_tags_xref AS txref ON txref.listing_id = listing.id'); $query->where('listing.approved = 1'); $query->where('listing.published = 1'); $query->where('(listing.publish_up = ' . $db->quote($nullDate) . ' OR listing.publish_up <= ' . $db->quote($nowDate) . ')'); $query->where('(listing.publish_down = ' . $db->quote($nullDate) . ' OR listing.publish_down >= ' . $db->quote($nowDate) . ')'); if ($user->get('guest')) { $query->where('listing.access IN (' . $levelsStr . ')'); } else { $query->where('(listing.access IN (' . $levelsStr . ') OR (listing.created_by = ' . $user->id . '))'); } $query->where('txref.tag_id=' . $tagId); $app = JFactory::getApplication(); $languageTag = JFactory::getLanguage()->getTag(); if ($app->getLanguageFilter()) { $query->where('listing.language IN (' . $db->quote($languageTag) . ',' . $db->quote('*') . ',' . $db->quote('') . ')'); } JUDirectoryFrontHelperField::appendFieldOrderingPriority($query, null, $ordering, $direction); return $query; }
public static function canEditStateListing($listingObject) { if (!is_object($listingObject)) { return false; } $listingId = $listingObject->id; if (!isset($listingObject->cat_id)) { $listingObject = JUDirectoryHelper::getListingById($listingId); } $mainCatId = $listingObject->cat_id; $userCanDoCategory = JUDirectoryFrontHelperPermission::canDoCategory($mainCatId); if (!$userCanDoCategory) { return false; } if ($listingObject->id) { $isListingOwner = JUDirectoryFrontHelperPermission::isListingOwner($listingObject->id); if ($isListingOwner) { $params = JUDirectoryHelper::getParams($mainCatId); $ownerCanEditStateListing = $params->get('listing_owner_can_edit_state_listing', 0); if ($ownerCanEditStateListing) { return true; } } } $isModerator = JUDirectoryFrontHelperModerator::isModerator(); if ($isModerator) { $modCanEditState = JUDirectoryFrontHelperModerator::checkModeratorCanDoWithListing($mainCatId, 'listing_edit_state'); if ($modCanEditState) { return true; } if ($listingObject->id && $listingObject->approved <= 0) { $modCanApprove = JUDirectoryFrontHelperModerator::checkModeratorCanDoWithListing($mainCatId, 'listing_approve'); if ($modCanApprove) { return true; } } } $user = JFactory::getUser(); if (!$user->get('guest')) { $corePublished = JUDirectoryFrontHelperField::getField('published', $listingObject); if ($corePublished) { if ($listingObject->approved <= 0) { if ($corePublished->canSubmit()) { return true; } } elseif ($listingObject->approved == 1) { if ($corePublished->canEdit()) { return true; } } } } return false; }
"><?php echo $fieldGroupName; ?> </td> </tr> <?php $fieldsInGroup = $this->model->getFieldsByGroupId($fieldGroupId); foreach ($fieldsInGroup as $fieldObj) { ?> <tr> <?php foreach ($this->items as $item) { ?> <td> <?php $field = JUDirectoryFrontHelperField::getField($fieldObj, $item); if (is_object($field) && ($field->canView(array("view" => "list")) || $field->canView(array("view" => "details")))) { echo $field->getDisplayPrefixText() . " " . $field->getOutput(array("view" => "list", "template" => $this->template)) . " " . $field->getDisplaySuffixText(); } ?> </td> <?php } ?> </tr> <?php } ?> <?php } ?>
public function delete($pk = null) { $k = $this->_tbl_key; $pk = is_null($pk) ? $this->{$k} : $pk; $this->load($pk); $pk = is_null($pk) ? $this->id : $pk; $db = JFactory::getDbo(); $fieldObj = JUDirectoryFrontHelperField::getField($pk); $fieldObj->onDelete(true); $query = "DELETE FROM #__judirectory_fields_ordering WHERE field_id = {$pk}"; $db->setQuery($query); $db->execute(); $query = "DELETE FROM #__judirectory_fields_values WHERE field_id = {$pk}"; $db->setQuery($query); $db->execute(); return parent::delete($pk); }
public function redirectUrl() { $app = JFactory::getApplication(); $fieldId = $app->input->getInt('field_id'); $listingId = $app->input->getInt('listing_id'); $field = JUDirectoryFrontHelperField::getField($fieldId, $listingId); $field->redirectUrl(); }
public function build(&$query) { $segments = array(); $app = JFactory::getApplication('site'); $menus = $app->getMenu('site'); $activeMenu = $menus->getActive(); $params = JUDirectoryHelper::getParams(); $homeItemId = JUDirectoryHelperRoute::getHomeMenuItemId(); if (empty($query['Itemid']) && isset($query['view']) && $query['view'] != 'category' && $query['view'] != 'listing') { $query['Itemid'] = JUDirectoryHelperRoute::findJUDirectoryTreeItemId(); } if (isset($query['view'])) { $menuItem = $menus->getItem($query['Itemid']); if (isset($menuItem) && ($menuItem->component != 'com_judirectory' && $menuItem->id != $homeItemId)) { unset($query['Itemid']); } } if (!$query || !isset($query['view']) && !isset($query['task'])) { if (isset($query['start'])) { $sefPageConfig = JApplication::stringURLSafe('page'); $pageX = JUDirectoryHelperRoute::getPage($query['start'], $activeMenu->query['view']); $segments[] = $sefPageConfig . ':' . $pageX; unset($query['start']); } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } if (isset($query['limit'])) { unset($query['limit']); } return $segments; } $hasActiveMenu = false; if (is_object($activeMenu) && isset($activeMenu->query)) { if (isset($query['Itemid']) && $query['Itemid'] == $activeMenu->id) { $hasActiveMenu = JUDirectoryHelperRoute::compareQuery($activeMenu, $query); } } if (isset($query['view']) && $query['view'] == 'categories') { if (!$hasActiveMenu) { if (isset($query['id'])) { if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } } $sefCategoriesConfig = JApplication::stringURLSafe('categories'); $segments[] = JApplication::stringURLSafe($sefCategoriesConfig); $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ":" . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } unset($query['view']); } if (isset($query['view']) && $query['view'] == 'category') { if (!$hasActiveMenu) { $fullPathCategory = $params->get('sef_category_full_path', 0); if (isset($query['id'])) { $segments = JUDirectoryHelperRoute::getCategorySegment($query['id'], $query, $fullPathCategory); if ($segments !== false) { unset($query['id']); } } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'advsearch') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('advanced-search'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'collection') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id']) && $query['id']) { if (isset($query['user_id'])) { $user = JFactory::getUser($query['user_id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['user_id'] . ':' . $userAlias; unset($query['user_id']); } $segments[] = JApplication::stringURLSafe('collection'); $collectionObject = JUDirectoryFrontHelper::getCollectionById($query['id']); $segments[] = $query['id'] . ':' . (isset($collectionObject->alias) ? $collectionObject->alias : ''); unset($query['id']); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { $segments[] = JApplication::stringURLSafe('collection'); $segments[] = JApplication::stringURLSafe('new-collection'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); if (isset($query['id'])) { unset($query['id']); } } } else { if (isset($query['user_id'])) { unset($query['user_id']); } if (isset($query['id'])) { unset($query['id']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'collections') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('collections'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'commenttree' && isset($query['id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('comment-tree'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; if (isset($query['tmpl'])) { $segments[] = JApplication::stringURLSafe('component'); unset($query['tmpl']); } unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'contact' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('contact'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'dashboard') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('dashboard'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listing') { if (!$hasActiveMenu) { $seoLayout = true; if (isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); unset($query['id']); } if (isset($query['print'])) { $seoLayout = false; $segments[] = JApplication::stringURLSafe('print'); unset($query['print']); unset($query['layout']); unset($query['tmpl']); } if ($seoLayout) { JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listings') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('modal-listings'); if (isset($query['tmpl'])) { $segments[] = $query['tmpl']; unset($query['tmpl']); } if (isset($query['function'])) { $segments[] = $query['function']; unset($query['function']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'featured') { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuFeatured = $menus->getItem($query['Itemid']); if ($assignMenuFeatured && isset($assignMenuFeatured->query) && $assignMenuFeatured->query['view'] == 'tree' && isset($assignMenuFeatured->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuFeatured->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $segments[] = JApplication::stringURLSafe('featured'); if (isset($query['all'])) { if ($query['all'] == 1) { $segments[] = JApplication::stringURLSafe('all'); } unset($query['all']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['all'])) { unset($query['all']); } if (isset($query['layout'])) { unset($query['layout']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'form' && isset($query['layout']) && $query['layout'] == 'edit' && (!isset($query['id']) || isset($query['id']) && !$query['id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['cat_id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['cat_id']); $segments[] = $query['cat_id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['cat_id']); } else { $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory(); if (is_object($categoryRoot)) { $segments[] = $categoryRoot->id . ':' . (isset($categoryRoot->alias) ? $categoryRoot->alias : ''); } } $segments[] = JApplication::stringURLSafe('new-listing'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'form' && isset($query['layout']) && $query['layout'] == 'edit' && isset($query['id']) && $query['id']) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); if (isset($query['approve']) && $query['approve'] == 1) { $segments[] = JApplication::stringURLSafe('approve'); unset($query['approve']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listall') { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $addCategoryToSegment = false; } else { $assignMenuListAll = $menus->getItem($query['Itemid']); if ($assignMenuListAll && isset($assignMenuListAll->query) && $assignMenuListAll->query['view'] == 'tree' && isset($assignMenuListAll->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuListAll->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $segments[] = JApplication::stringURLSafe('list-all'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listalpha') { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuListAlpha = $menus->getItem($query['Itemid']); if ($assignMenuListAlpha && isset($assignMenuListAlpha->query) && $assignMenuListAlpha->query['view'] == 'tree' && isset($assignMenuListAlpha->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuListAlpha->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $segments[] = JApplication::stringURLSafe('list-alpha'); if (isset($query['alpha'])) { $segments[] = $query['alpha']; unset($query['alpha']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['alpha'])) { unset($query['alpha']); } if (isset($query['layout'])) { unset($query['layout']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'maintenance') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('maintenance'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modcomment' && isset($query['layout']) && $query['layout'] == 'edit' && isset($query['id']) && $query['id']) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); if (is_object($commentObject)) { $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; unset($query['id']); } if (isset($query['approve']) && $query['approve']) { $segments[] = JApplication::stringURLSafe('approve'); unset($query['approve']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); unset($query['layout']); } if (isset($query['view']) && $query['view'] == 'modcomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modlistings') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-listings'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpermission' && isset($query['id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-permission'); $segments[] = $query['id']; JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpermissions') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-permissions'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpendingcomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-pending-comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpendinglistings') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-pending-listings'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'profile') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('profile'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'claim' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('claim'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'report' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('report'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'report' && isset($query['comment_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['comment_id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['comment_id'] . ':' . $commentAlias; unset($query['comment_id']); $segments[] = JApplication::stringURLSafe('report'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['comment_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'search') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['cat_id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['cat_id']); $segments[] = $query['cat_id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['cat_id']); } if (isset($query['sub_cat'])) { $segments[] = JApplication::stringURLSafe('all'); unset($query['sub_cat']); } $segments[] = JApplication::stringURLSafe('search'); if (isset($query['searchword'])) { $segments[] = $query['searchword']; unset($query['searchword']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['cat_id'])) { unset($query['cat_id']); } if (isset($query['searchword'])) { unset($query['searchword']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'searchby') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('search-by'); if (isset($query['field_id'])) { $fieldObject = JUDirectoryFrontHelperField::getFieldById($query['field_id']); $segments[] = $query['field_id'] . ':' . (isset($fieldObject->alias) ? $fieldObject->alias : ''); unset($query['field_id']); } if (isset($query['value'])) { $segments[] = $query['value']; unset($query['value']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['field_id'])) { unset($query['field_id']); } if (isset($query['value'])) { unset($query['value']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'subscribe' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('guest-subscribe'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'tag' && isset($query['id'])) { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('tag'); $tagObject = JUDirectoryFrontHelper::getTagById($query['id']); $segments[] = $query['id'] . ':' . (isset($tagObject->alias) ? $tagObject->alias : ''); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'tags') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('tags'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'topcomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('top-comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'customlist') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('custom-list'); if (isset($query['id'])) { if ($query['id']) { $customListObject = JUDirectoryHelper::getCustomListById($query['id']); $segments[] = $query['id'] . ':' . (isset($customListObject->alias) ? $customListObject->alias : ''); } unset($query['id']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'compare') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('compare'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'toplistings') { $addCategoryToSegment = true; if (!$hasActiveMenu) { if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuTopListings = $menus->getItem($query['Itemid']); if ($assignMenuTopListings && isset($assignMenuTopListings->query) && $assignMenuTopListings->query['view'] == 'tree' && isset($assignMenuTopListings->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuTopListings->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } if (isset($query['ordertype'])) { switch ($query['ordertype']) { case 'new': $segments[] = JApplication::stringURLSafe('latest-listings'); break; case 'featured': $segments[] = JApplication::stringURLSafe('top-featured-listings'); break; case 'recent_modified': $segments[] = JApplication::stringURLSafe('recent-modified-listings'); break; case 'recent_updated': $segments[] = JApplication::stringURLSafe('recent-updated-listings'); break; case 'popular': $segments[] = JApplication::stringURLSafe('popular-listings'); break; case 'most_rated': $segments[] = JApplication::stringURLSafe('most-rated-listings'); break; case 'top_rated': $segments[] = JApplication::stringURLSafe('top-rated-listings'); break; case 'latest_rated': $segments[] = JApplication::stringURLSafe('latest-rated-listings'); break; case 'most_commented': $segments[] = JApplication::stringURLSafe('most-commented-listings'); break; case 'latest_commented': $segments[] = JApplication::stringURLSafe('latest-commented-listings'); break; case 'recently_viewed': $segments[] = JApplication::stringURLSafe('recent-viewed-listings'); break; case 'alpha_ordered': $segments[] = JApplication::stringURLSafe('alpha-ordered-listings'); break; case 'random': $segments[] = JApplication::stringURLSafe('random-listings'); break; case 'random_fast': $segments[] = JApplication::stringURLSafe('random-fast-listings'); break; case 'random_featured': $segments[] = JApplication::stringURLSafe('random-featured-listings'); break; default: $segments[] = JApplication::stringURLSafe('latest-listings'); } unset($query['ordertype']); } if (isset($query['all'])) { if ($query['all'] == 1) { $segments[] = JApplication::stringURLSafe('all'); } unset($query['all']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['ordertype'])) { unset($query['ordertype']); } if (isset($query['all'])) { unset($query['all']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'tree' && isset($query['id'])) { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuTree = $menus->getItem($query['Itemid']); if ($assignMenuTree && isset($assignMenuTree->query) && $assignMenuTree->query['view'] == 'tree' && isset($assignMenuTree->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuTree->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } $segments[] = 'tree'; if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'usercomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'userlistings') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('listings'); if (isset($query['filter'])) { if ($query['filter'] == 'pending') { $segments[] = JApplication::stringURLSafe('pending'); } elseif ($query['filter'] == 'unpublished') { $segments[] = JApplication::stringURLSafe('unpublished'); } else { $segments[] = JApplication::stringURLSafe('published'); } unset($query['filter']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['filter'])) { unset($query['filter']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'usersubscriptions' && isset($query['id'])) { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; $segments[] = JApplication::stringURLSafe('user-subscriptions'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if ($query['layout']) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['id']); unset($query['view']); } if (isset($query['task']) && $query['task'] == 'form.add') { if (isset($query['cat_id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['cat_id']); if (is_object($categoryObject)) { $segments[] = $query['cat_id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['cat_id']); } } $segments[] = JApplication::stringURLSafe('add'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'form.edit' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('edit'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.delete' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('delete'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.checkin' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('checkin'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'listing.removeCompare' && isset($query['listing_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('remove-compare'); unset($query['listing_id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'listing.removeCompare' && isset($query['all']) && $query['all'] == 1) { $segments[] = JApplication::stringURLSafe('remove-compare'); $segments[] = JApplication::stringURLSafe('all'); unset($query['all']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'modpendinglisting.edit' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); if (isset($query['approve'])) { $segments[] = JApplication::stringURLSafe('approve'); unset($query['approve']); } if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.unpublish' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('unpublish'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.publish' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('publish'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.save' && isset($query['listing_id']) && !isset($query['comment_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('subscribe'); unset($query['listing_id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'listing.redirecturl') { if (isset($query['listing_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); unset($query['listing_id']); } if (isset($query['field_id'])) { $fieldObject = JUDirectoryFrontHelperField::getFieldById($query['field_id']); $segments[] = $query['field_id'] . ':' . (isset($fieldObject->alias) ? $fieldObject->alias : ''); unset($query['field_id']); } $segments[] = JApplication::stringURLSafe('redirect-url'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'modcomment.edit' && isset($query['id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; unset($query['id']); $segments[] = JApplication::stringURLSafe('edit'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['task']); } if (isset($query['task']) && $query['task'] == 'modpendingcomment.edit' && isset($query['id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; unset($query['id']); $segments[] = JApplication::stringURLSafe('approve'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.save' && isset($query['comment_id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['comment_id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['comment_id'] . ':' . $commentAlias; unset($query['comment_id']); $segments[] = JApplication::stringURLSafe('subscribe'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.remove' && isset($query['sub_id'])) { $subscriptionObject = JUDirectoryFrontHelper::getSubscriptionObject($query['sub_id']); if ($subscriptionObject->type == 'listing') { $segments = JUDirectoryHelperRoute::getListingSegment($subscriptionObject->item_id, $query, $params); $segments[] = JApplication::stringURLSafe('unsubscribe'); $segments[] = $query['sub_id']; if ($query['code']) { $segments[] = $query['code']; unset($query['code']); } unset($query['listing_id']); unset($query['task']); unset($query['sub_id']); unset($query['task']); } elseif ($subscriptionObject->type == 'comment') { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($subscriptionObject->item_id); if (is_object($commentObject)) { $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $commentObject->id . ':' . $commentAlias; } $segments[] = JApplication::stringURLSafe('unsubscribe'); $segments[] = $query['sub_id']; if ($query['code']) { $segments[] = $query['code']; unset($query['code']); } unset($query['sub_id']); unset($query['task']); } } if (isset($query['task']) && $query['task'] == 'listing.deleteComment' && isset($query['comment_id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['comment_id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['comment_id'] . ':' . $commentAlias; unset($query['comment_id']); $segments[] = JApplication::stringURLSafe('delete'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'collection.add') { $segments[] = JApplication::stringURLSafe('collection'); $segments[] = JApplication::stringURLSafe('add'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'collection.edit' && isset($query['id'])) { if (isset($query['user_id'])) { $user = JFactory::getUser($query['user_id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['user_id'] . ':' . $userAlias; unset($query['user_id']); } $segments[] = JApplication::stringURLSafe('collection'); $collectionObject = JUDirectoryFrontHelper::getCollectionById($query['id']); $segments[] = $query['id'] . ':' . (isset($collectionObject->alias) ? $collectionObject->alias : ''); unset($query['id']); $segments[] = JApplication::stringURLSafe('edit'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['task']); } if (isset($query['task']) && $query['task'] == 'collections.delete' && isset($query['cid'])) { $segments[] = JApplication::stringURLSafe('collection'); $collectionObject = JUDirectoryFrontHelper::getCollectionById($query['cid']); $segments[] = $query['cid'] . ':' . (isset($collectionObject->alias) ? $collectionObject->alias : ''); unset($query['cid']); $segments[] = JApplication::stringURLSafe('delete'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'usersubscriptions.unsubscribe' && isset($query['sub_id'])) { $segments[] = JApplication::stringURLSafe('user-subscriptions'); $segments[] = $query['sub_id']; $segments[] = JApplication::stringURLSafe('unsubscribe'); unset($query['sub_id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'rawdata') { if (isset($query['listing_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); unset($query['listing_id']); } if (isset($query['field_id'])) { $fieldObject = JUDirectoryFrontHelperField::getFieldById($query['field_id']); $segments[] = $query['field_id'] . ':' . (isset($fieldObject->alias) ? $fieldObject->alias : ''); unset($query['field_id']); } $segments[] = JApplication::stringURLSafe('raw-data'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.activate') { $segments[] = JApplication::stringURLSafe('activate-subscription'); if ($query['id']) { $segments[] = $query['id']; } if (isset($query['code'])) { $segments[] = $query['code']; } unset($query['task']); } if (isset($query['task']) && $query['task'] == 'email.downloadattachment') { $segments[] = JApplication::stringURLSafe('email'); $segments[] = JApplication::stringURLSafe('download-attachment'); if (isset($query['mail_id'])) { $segments[] = $query['mail_id']; unset($query['mail_id']); } if (isset($query['file'])) { $segments[] = $query['file']; unset($query['file']); } if (isset($query['code'])) { $segments[] = $query['code']; unset($query['code']); } unset($query['task']); } $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } if (isset($query['limit'])) { unset($query['limit']); } return $segments; }
<h3 class="comment-username" itemprop="creator" itemscope="" itemtype="http://schema.org/Person"> <span itemprop="name"> <?php if ($commentObj->user_id > 0) { $userComment = JFactory::getUser($commentObj->user_id); echo $userComment->get('name'); } else { echo $commentObj->guest_name; } ?> </span> </h3> <?php if ($commentObj->parent_id == $this->root_comment->id) { $fieldRating = JUDirectoryFrontHelperField::getField('rating', $commentObj->listing_id); echo $fieldRating->getOutput(array('view' => 'details', 'template' => $this->template, 'type' => 'comment', 'comment_object' => $commentObj)); } ?> </div> <!-- /.comment-user --> <div class="comment-text"> <div class="judir-metadata clearfix"> <h4 class="comment-title" itemprop="name"><?php echo $commentObj->title; ?> </h4> <div itemprop="datePublished" class="comment-created"> <?php
protected function _prepareData() { $this->token = JSession::getFormToken(); $this->session = JFactory::getSession(); $this->item->related_listings = $this->model->getRelatedListings($this->item->id); if (count($this->item->related_listings)) { foreach ($this->item->related_listings as $listingRelated) { $listingRelated->link = JRoute::_(JUDirectoryHelperRoute::getListingRoute($listingRelated->id)); $listingRelated->image = JUDirectoryHelper::getListingImage($listingRelated->image); } } $additionFields = $ignoredFields = array(); $this->item->fieldLocations = JUDirectoryFrontHelperField::getField('locations', $this->item); $this->item->fieldGallery = JUDirectoryFrontHelperField::getField('gallery', $this->item); $this->item->fields = JUDirectoryFrontHelperField::getFields($this->item, 2, array(), array('gallery', 'locations'), $additionFields); $user = JFactory::getUser(); $uri = JUri::getInstance(); if ($this->item->checked_out > 0 && $this->item->checked_out != $user->get('id')) { if (JUDirectoryFrontHelperPermission::canCheckInListing($this->item->id)) { $this->item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $this->item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri))); } } else { $this->item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $this->item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($this->item->id)); if ($this->item->published == 1) { $this->item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $this->item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($this->item->id)); } else { $this->item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $this->item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($this->item->id)); } } $this->item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $this->item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($this->item->id)); $this->item->contact_link = JRoute::_(JUDirectoryHelperRoute::getContactRoute($this->item->id)); $this->item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($this->item->id)); $this->item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($this->item->id)); $this->item->print_link = JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->item->id) . '&layout=print&tmpl=component&print=1'); $this->item->comment = new stdClass(); $this->item->comment->total_comments_no_filter = $this->model->getTotalCommentsOfListing($this->item->id); $this->root_comment = JUDirectoryFrontHelperComment::getRootComment(); $langArray = JHtml::_('contentlanguage.existing'); $JAll = new JObject(); $JAll->text = JText::_('JALL'); $JAll->value = '*'; array_unshift($langArray, $JAll); $this->langArray = $langArray; $this->item->comment->items = $this->get('Items'); foreach ($this->item->comment->items as $comment) { if (JUDirectoryFrontHelperPermission::canCheckInComment($comment->id)) { $uri = JUri::getInstance(); $comment->checkout_link = 'index.php?option=com_judirectory&task=modcomments.checkin&cid=' . $comment->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)); } else { $comment->checkout_link = ''; } } $this->item->comment->pagination = $this->get('Pagination'); $this->item->comment->total_comments = $this->get('Total'); $this->item->comment->parent_id = $this->root_comment->id; $this->website_field_in_comment_form = $this->params->get('website_field_in_comment_form', 0); $this->min_comment_characters = $this->params->get('min_comment_characters', 20); $this->max_comment_characters = $this->params->get('max_comment_characters', 1000); $this->allow_vote_comment = $this->params->get('allow_vote_comment', 1); $this->allow_vote_down_comment = $this->params->get('allow_vote_down_comment', 1); $this->order_comment_name_array = $this->model->getCommentOrderingOptions(); $this->order_comment_dir_array = array('ASC' => JText::_('COM_JUDIRECTORY_ASC'), 'DESC' => JText::_('COM_JUDIRECTORY_DESC')); $this->total_stars = $this->params->get('number_rating_stars', 5); $this->filter_comment_stars = array('' => JText::_('COM_JUDIRECTORY_ANY_STAR')); for ($i = 0; $i <= $this->total_stars; $i++) { $score = $i == 0 ? 0 : round(($i - 1) * 10 / $this->total_stars, 5) . ',' . round($i * 10 / $this->total_stars, 5); $this->filter_comment_stars[$score] = JText::plural('COM_JUDIRECTORY_N_STAR', $i); } if ($this->params->get('filter_comment_language', 0)) { $this->list_lang_comment = $this->escape($this->state->get('list.lang')); } $this->list_order_comment = $this->escape($this->state->get('list.ordering')); $this->list_dir_comment = $this->escape($this->state->get('list.direction')); $this->filter_comment_star = $this->state->get('list.star_filter', ''); $this->website = $this->title = $this->email = $this->comment = $this->name = ''; $this->language = '*'; $form = $this->session->get('judirectory_commentform_' . $this->item->id, null); $this->form = $form; if (!empty($form) && $form['parent_id'] == $this->root_comment->id) { $this->title = $form['title']; $this->name = $form['guest_name']; $this->email = $form['guest_email']; $this->comment = $form['comment']; $this->website = isset($form['website']) ? $form['website'] : ''; $this->language = $form['comment_language']; } }