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)
 {
     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);
 }
Exemple #4
0
 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();
 }
Exemple #5
0
 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}");
     }
 }
Exemple #6
0
"><?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 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;
 }
Exemple #8
0
 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;
 }
Exemple #9
0
 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);
 }
Exemple #10
0
 public function getGalleryField()
 {
     $app = JFactory::getApplication();
     $docId = $app->input->getInt('id', 0);
     $galleryField = JUDirectoryFrontHelperField::getField('gallery', $docId);
     if ($this->getListingSubmitType($docId) == 'submit' && $galleryField->canSubmit() || $this->getListingSubmitType($docId) == 'edit' && $galleryField->canEdit()) {
         return $galleryField;
     }
     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;
 }
Exemple #12
0
 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;
 }
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();
							<?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>
 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;
 }
Exemple #16
0
 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;
 }
								<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'];
     }
 }