public function display($tpl = null) { $this->model = $this->getModel(); $this->state = $this->get('State'); $this->params = $this->state->get('params'); $user = JFactory::getUser(); $uri = JUri::getInstance(); $this->items = $this->get('Items'); foreach ($this->items as $item) { $item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($item->id)); $item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($item->id)); if ($item->checked_out > 0 && $item->checked_out != $user->get('id')) { if (JUDirectoryFrontHelperPermission::canCheckInListing($item->id)) { $item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri))); } } else { $item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id)); if ($item->published == 1) { $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id)); } else { $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id)); } } $item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id)); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $item->event = new stdClass(); $context = 'com_judirectory.listing_list'; $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$this->item, &$this->params, 0)); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$this->item, &$this->params, 0)); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$this->item, &$this->params, 0)); $item->event->afterDisplayContent = trim(implode("\n", $results)); } $this->pagination = $this->get('Pagination'); $this->token = JSession::getFormToken(); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->show_feed = JUDIRPROVERSION ? $this->params->get('rss_display_icon', 1) : 0; $app = JFactory::getApplication(); $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $this->categoryId = $app->input->getInt('id', $rootCategory->id); $this->fetchAllSubCat = $app->input->getInt('all', 0); $rssLink = JRoute::_(JUDirectoryHelperRoute::getFeaturedRoute($this->categoryId, $this->fetchAllSubCat, false, true)); $this->rss_link = JRoute::_($rssLink, false); $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx')); $this->_prepareData(); $this->_prepareDocument(); $this->_setBreadcrumb(); parent::display($tpl); }
protected function getInput() { $attr = $this->multiple ? ' multiple="multiple" size="7"' : ''; $nestedCategories = JUDirectoryFrontHelperCategory::getCategoriesRecursive(1, false, true, true); $options = array(); foreach ($nestedCategories as $categoryObj) { $options[] = JHtml::_('select.option', $categoryObj->id, str_repeat('|—', $categoryObj->level) . $categoryObj->title); } $html = JHtml::_('select.genericList', $options, $this->name, $attr, 'value', 'text', $this->value); return $html; }
public function cancel($key = null) { parent::cancel($key = null); $app = JFactory::getApplication(); $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $parent_cat_id = $app->input->getInt('parent_id', $rootCat->id); $cat_id = $app->input->getInt('id', 0); if ($cat_id) { $parent_cat_id = JUDirectoryHelper::getCategoryById($cat_id)->parent_id; } $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id=" . $parent_cat_id); }
public function back() { $app = JFactory::getApplication(); $listing_id = $app->input->getInt('listing_id', 0); $cat_id = JUDirectoryFrontHelperCategory::getRootCategory()->id; if ($listing_id) { $listingObj = JUDirectoryHelper::getListingById($listing_id); if (isset($listingObj->cat_id) && $listingObj->cat_id) { $cat_id = $listingObj->cat_id; } } $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id={$cat_id}"); }
public function getInput() { $categories = JUDirectoryHelper::getCatsByLevel(1); $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $document = JFactory::getDocument(); $script = 'jQuery(document).ready(function($){ $("#cat-' . $rootCategory->id . '").change(function(){ if($(this).is(":checked")){ $(this).parent().parent().find(".category-checkbox").attr("disabled", true).prop("checked", true); }else{ $(this).parent().parent().find(".category-checkbox").attr("disabled", false).prop("checked", false); } }); });'; $document->addScriptDeclaration($script); $relCatIds = array(); if ($this->form->getValue('id')) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('c.id'); $query->from('#__judirectory_categories AS c'); $query->join('', '#__judirectory_emails_xref AS exref ON (exref.cat_id = c.id)'); $query->join('', '#__judirectory_emails AS e ON (exref.email_id = e.id)'); $query->where('exref.email_id = ' . $this->form->getValue('id')); $db->setQuery($query); $relCatIds = $db->loadColumn(); } $html = '<div id="categoriestoassignemail" class="categoriestoassignemail">'; $html .= '<ul id="' . $this->id . '" class="nav">'; $html .= '<li>'; $html .= '<input id="cat-' . $rootCategory->id . '" name="' . $this->name . '[]" value = "' . $rootCategory->id . '" ' . (in_array($rootCategory->id, $relCatIds) ? 'checked="checked"' : '') . ' class="input" type="checkbox" />'; $html .= '<label for="cat-' . $rootCategory->id . '">' . str_repeat('<span class="gi">|—</span>', $rootCategory->level) . $rootCategory->title . '</label>'; $html .= '</li>'; if ($categories) { foreach ($categories as $category) { $html .= '<li>'; $attr = ''; if (in_array($rootCategory->id, $relCatIds)) { $attr = 'checked="checked" disabled="disabled"'; } elseif (in_array($category->id, $relCatIds)) { $attr = 'checked="checked"'; } $html .= '<input id="cat-' . $category->id . '" class="input category-checkbox" type="checkbox" name="' . $this->name . '[]" value = "' . $category->id . '" ' . $attr . '/>'; $html .= '<label for="cat-' . $category->id . '">' . str_repeat('<span class="gi">|—</span>', $category->level) . $category->title . '</label>'; $html .= '</li>'; } } $html .= '</ul></div>'; return $html; }
public function resetDefault() { JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $defaultConfig = '{"activate_maintenance":"0","maintenance_message":"Directory area is down for maintenance.<br \\/> Please check back again soon.","number_rating_stars":5,"rating_star_width":16,"split_star":"2","enable_listing_rate":"1","enable_listing_rate_in_comment_form":"1","require_listing_rate_in_comment_form":"1","rating_interval":86400,"only_calculate_last_rating":"0","rating_explanation":"1:Bad\\r\\n3:Poor\\r\\n5:Fair\\r\\n7:Good\\r\\n9:Excellent","rating_statistic":"","min_rates_to_show_rating":0,"min_rates_for_top_rated":0,"listing_report_subjects":"Broken link\\r\\nCopyright infringement\\r\\nWrong category","comment_report_subjects":"Spam\\r\\nInappropriate","listing_owner_use_captcha_when_report":"0","collection_allow_vote":"1","collection_allow_vote_down":"1","collection_allow_owner_vote":"0","collection_allow_guest_vote":"1","collection_desc_limit":500,"log_events_for_guest":"0","captcha_width":155,"captcha_height":50,"captcha_length":6,"captcha_color":"#050505","captcha_bg_color":"#ffffff","captcha_line_color":"#707070","captcha_noise_color":"#707070","captcha_num_lines":5,"captcha_noise_level":2,"captcha_perturbation":5,"captcha_font":"AHGBold.ttf","map_api_key":"","map_center":"62.323907,-150.109291","map_zoom":"2","map_fitbound_maxzoom":"13","map_language":"","map_region":"ar","edit_account_details":"1","public_user_dashboard":"0","searchword_min_length":"3","searchword_max_length":"30","limit_string":"5,10,15,20,25,30,50","plugin_support":"0","activate_subscription_by_email":"1","field_attachment_directory":"media\\/com_judirectory\\/field_attachments\\/","category_fields_listview_ordering":{"title":"2","id":"2","alias":"0","parent_id":"0","rel_cats":"0","access":"0","lft":"0","fieldgroup_id":"0","criteriagroup_id":"0","featured":"0","published":"0","show_item":"0","description":"0","intro_image":"0","detail_image":"0","publish_up":"0","publish_down":"0","created_by":"0","created":"0","modified_by":"0","modified":"0","style_id":"0","layout":"0","metatitle":"0","metakeyword":"0","metadescription":"0","metadata":"0","total_categories":"0","total_listings":"0"},"template_upload_limit":"2","template_image_formats":"gif,bmp,jpg,jpeg,png","template_source_formats":"txt,less,ini,xml,js,php,css","template_font_formats":"woff,ttf,otf","template_compressed_formats":"zip","allow_add_listing_to_root":"0","reset_listing_alias_when_approving":"1","listing_owner_can_view_unpublished_listing":"0","listing_owner_can_edit_listing_auto_approval":"1","auto_approval_listing_threshold":0,"listing_owner_can_edit_state_listing":"0","listing_owner_can_report_listing":"1","claim_type":"groups","claim_groups":["8"],"claim_users":"","max_recently_viewed_listings":12,"required_fields_to_mark_listing_as_updated":"","can_change_main_category":"1","can_change_secondary_categories":"1","max_cats_per_listing":10,"max_images_per_listing":8,"max_tags_per_listing":10,"submit_listing_interval":30,"assign_itemid_to_submit_link":"currentItemid","predefined_itemid_for_submit_link":0,"max_related_listings":12,"related_listings_ordering":"listingrel.ordering","related_listings_direction":"ASC","imagequality":90,"customfilters":"","sharpen":"0","canvastransparency":"1","canvascolour":"#ffffff","listing_small_image_width":100,"listing_small_image_height":100,"listing_small_image_zoomcrop":"1","listing_small_image_alignment":"c","listing_big_image_width":600,"listing_big_image_height":600,"listing_big_image_zoomcrop":"3","listing_big_image_alignment":"c","use_watermark":"0","watermark_image":"","watermark_text":"","watermark_font":"arial.ttf","watermark_fontsize":14,"watermark_fontcolor":"#ffffff","watermark_backgroundcolor":"#144274","watermark_halign":"0","watermark_valign":"0","watermark_offsetx":0,"watermark_offsety":0,"watermark_opacity":"0.8","watermark_rotate":0,"image_min_width":50,"image_min_height":50,"image_max_width":1024,"image_max_height":1024,"image_max_size":400,"listing_default_image":"-1","listing_image_width":100,"listing_image_height":100,"listing_image_zoomcrop":"1","listing_image_alignment":"c","category_intro_image_width":200,"category_intro_image_height":200,"category_intro_image_zoomcrop":"1","category_intro_image_alignment":"c","category_detail_image_width":200,"category_detail_image_height":200,"category_detail_image_zoomcrop":"1","category_detail_image_alignment":"c","avatar_source":"juavatar","default_avatar":"default-avatar.png","avatar_width":120,"avatar_height":120,"avatar_zoomcrop":"1","avatar_alignment":"c","collection_default_icon":"-1","collection_icon_width":100,"collection_icon_height":100,"collection_icon_zoomcrop":"1","collection_icon_alignment":"c","listing_image_filename_rule":"{image_name}","listing_original_image_directory":"media\\/com_judirectory\\/images\\/gallery\\/original\\/","listing_small_image_directory":"media\\/com_judirectory\\/images\\/gallery\\/small\\/","listing_big_image_directory":"media\\/com_judirectory\\/images\\/gallery\\/big\\/","listing_image_directory":"media\\/com_judirectory\\/images\\/listing\\/","category_image_filename_rule":"{category}","category_intro_image_directory":"media\\/com_judirectory\\/images\\/category\\/intro\\/","category_detail_image_directory":"media\\/com_judirectory\\/images\\/category\\/detail\\/","avatar_directory":"media\\/com_judirectory\\/images\\/avatar\\/","collection_icon_directory":"media\\/com_judirectory\\/images\\/collection\\/","comment_system":"default","disqus_username":"","show_comment_direction":"1","comment_ordering":"cm.created","comment_direction":"DESC","show_comment_pagination":"0","comment_pagination":10,"filter_comment_rating":"1","filter_comment_language":"0","max_comment_level":5,"auto_link_url_in_comment":"1","nofollow_link_in_comment":"1","trim_long_url_in_comment":0,"front_portion_url_in_comment":0,"back_portion_url_in_comment":0,"auto_embed_youtube_in_comment":"0","auto_embed_vimeo_in_comment":"0","video_width_in_comment":360,"video_height_in_comment":240,"comment_interval":60,"comment_interval_in_same_listing":60,"auto_approval_comment_threshold":0,"auto_approval_comment_reply_threshold":0,"allow_edit_comment_within":600,"unpublish_comment_by_reporting_threshold":10,"allow_vote_comment":"1","allow_vote_down_comment":"1","can_reply_own_comment":"0","can_vote_own_comment":"0","can_subscribe_own_comment":"1","can_report_own_comment":"1","delete_own_comment":"0","listing_owner_can_comment":"0","listing_owner_can_comment_many_times":"0","listing_owner_auto_approval_when_comment":"0","listing_owner_can_reply_comment":"1","listing_owner_auto_approval_when_reply_comment":"0","listing_owner_use_captcha_when_comment":"1","listing_owner_can_vote_comment":"1","listing_owner_can_report_comment":"1","website_field_in_comment_form":"0","comment_form_editor":"wysibb","min_comment_characters":20,"max_comment_characters":1000,"bb_bold_tag":"Bold","bb_italic_tag":"Italic","bb_underline_tag":"Underline","bb_img_tag":"Picture","bb_link_tag":"Link","bb_video_tag":"Video","bb_color_tag":"Colors","bb_smilebox_tag":"Smilebox","bb_fontsize_tag":"Fontsize","bb_bulleted_list":"Bulleted-list","bb_numeric_list":"Numeric-list","bb_quote_tag":"Quotes","bb_readmore_tag":"Readmore","bb_code_tag":"Code","bb_align_left":"alignleft","bb_align_center":"aligncenter","bb_align_right":"alignright","userid_blacklist":"","forbidden_names":"","forbidden_words":"","forbidden_words_replaced_by":"***","block_ip":"0","ip_whitelist":"","ip_blacklist":"","top_comment_level":"all","top_comments_limit":100,"email_attachment_directory":"media\\/com_judirectory\\/email_attachments\\/","email_upload_maxsize":10240,"email_upload_legal_extensions":"bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,zip,rar","email_check_mime":"0","email_image_legal_extensions":"bmp,gif,jpg,png","email_ignored_extensions":"","email_upload_legal_mime":"image\\/jpeg,image\\/gif,image\\/png,image\\/bmp,application\\/x-shockwave-flash,application\\/msword,application\\/excel,application\\/pdf,application\\/powerpoint,text\\/plain,application\\/zip","email_embedded_files":"0","email_charset":"UTF-8","enable_mailq":"0","use_mailq_default":"0","send_mailqs_on_pageload":"0","total_mailqs_sent_each_time":5,"mailq_max_attempts":5,"delete_error_mailq":"0","all_categories_show_category_title":"1","all_categories_subcategory_level":"-1","all_categories_show_empty_category":"1","all_categories_show_total_subcategories":"1","all_categories_show_total_listings":"1","all_categories_columns":2,"all_categories_column_class":"","all_categories_row_class":"","show_featured_label":"1","show_hot_label":"1","num_hit_per_day_to_be_hot":100,"show_new_label":"1","num_day_to_show_as_new":10,"show_updated_label":"1","num_day_to_show_as_updated":10,"show_empty_field":"0","submit_form_show_tab_related":"0","submit_form_show_tab_plugin_params":"0","submit_form_show_tab_publishing":"0","submit_form_show_tab_style":"0","submit_form_show_tab_meta_data":"0","submit_form_show_tab_params":"0","submit_form_show_tab_permissions":"0","show_header_sort":"1","listing_pagination":10,"show_pagination":"1","default_view_mode":"2","allow_user_select_view_mode":"1","listing_columns":2,"listing_column_class":"","listing_row_class":"","show_compare_btn_in_listview":"0","list_alpha":"0-9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z","top_listings_limit":100,"show_submit_listing_btn_in_category":"1","category_show_description":"1","category_desc_limit":0,"category_show_image":"1","category_image_width":200,"category_image_height":200,"related_category_ordering":"crel.ordering","related_category_direction":"ASC","show_empty_related_category":"1","show_total_subcats_of_relcat":"0","show_total_listings_of_relcat":"0","related_category_show_introtext":"1","related_category_introtext_character_limit":500,"related_category_show_intro_image":"1","related_category_intro_image_width":200,"related_category_intro_image_height":200,"related_category_columns":2,"related_category_column_class":"","related_category_row_class":"","subcategory_ordering":"title","subcategory_direction":"ASC","show_empty_subcategory":"1","show_total_subcats_of_subcat":"0","show_total_listings_of_subcat":"0","subcategory_show_introtext":"1","subcategory_introtext_character_limit":500,"subcategory_show_intro_image":"1","subcategory_intro_image_width":200,"subcategory_intro_image_height":200,"subcategory_columns":2,"subcategory_column_class":"","subcategory_row_class":"","display_params":{"listing":{"show_comment":"1","fields":{"title":{"details_view":"1"},"created":{"details_view":"1"},"author":{"details_view":"1"},"cat_id":{"details_view":"1"},"rating":{"details_view":"1"}}},"cat":{"show_description":"1"}},"seo_replace_title_option":"replace","seo_replace_description_option":"replace","seo_replace_keywords_option":"replace","seo_title_length":64,"seo_description_length":160,"seo_keywords_length":160,"seo_user_title":"{user_name}","seo_user_description":"{meta_description}","seo_user_keywords":"{meta_keywords}","seo_collection_title":"{collection_title}","seo_collection_description":"{meta_description}","seo_collection_keywords":"{meta_keywords}","seo_listing_title":"{listing_title}","seo_listing_description":"{meta_description}","seo_listing_keywords":"{meta_keywords}","seo_category_title":"{cat_title}","seo_category_description":"{meta_description}","seo_category_keywords":"{meta_keywords}","seo_field_title":"{field_title}","seo_field_description":"{meta_description}","seo_field_keywords":"{meta_keywords}","seo_tag_title":"{tag_title}","seo_tag_description":"{meta_description}","seo_tag_keywords":"{meta_keywords}","sef_category_full_path":"0","sef_listing_full_path":"0","sef_categories":"categories","sef_tree":"tree","sef_featured":"featured","sef_list_all":"list-all","sef_list_alpha":"list-alpha","sef_tags":"tags","sef_tag":"tag","sef_collections":"collections","sef_collection":"collection","sef_custom_list":"custom-list","sef_advanced_search":"advsearch","sef_search":"search","sef_searchby":"searchby","sef_guest_subscribe":"guest-subscribe","sef_maintenance":"maintenance","sef_listings":"modal-listings","sef_contact":"contact","sef_claim":"claim","sef_compare":"compare","sef_comment_tree":"comment-tree","sef_top_comments":"top-comments","sef_top_listings_latest":"latest-listings","sef_top_listings_featured":"top-featured-listings","sef_top_listings_recent_modified":"recent-modified-listings","sef_top_listings_recent_updated":"recent-updated-listings","sef_top_listings_popular":"popular-listings","sef_top_listings_most_rated":"most-rated-listings","sef_top_listings_top_rated":"top-rated-listings","sef_top_listings_latest_rated":"latest-rated-listings","sef_top_listings_most_commented":"most-commented-listings","sef_top_listings_latest_commented":"latest-commented-listings","sef_top_listings_recently_viewed":"recent-viewed-listings","sef_top_listings_alpha_ordered":"alpha-ordered-listings","sef_top_listings_random":"random-listings","sef_top_listings_random_fast":"random-fast-listings","sef_top_listings_random_featured":"random-featured-listings","sef_add":"add","sef_edit":"edit","sef_delete":"delete","sef_publish":"publish","sef_unpublish":"unpublish","sef_checkin":"checkin","sef_approve":"approve","sef_subscribe":"subscribe","sef_unsubscribe":"unsubscribe","sef_activate_subscription":"activate-subscription","sef_print":"print","sef_download_email_attachment":"download-attachment","sef_remove_compare":"remove-compare","sef_remove_compare_all":"all","sef_redirect_url":"redirect-url","sef_dashboard":"dashboard","sef_profile":"profile","sef_user_listings":"listings","sef_published":"published","sef_unpublished":"unpublished","sef_pending":"pending","sef_user_subscriptions":"subscriptions","sef_user_comments":"comments","sef_mod_listings":"mod-listings","sef_mod_comments":"mod-comments","sef_mod_comment":"mod-comment","sef_mod_pending_listings":"mod-pending-listings","sef_mod_pending_listing":"mod-pending-listing","sef_mod_pending_comments":"mod-pending-comments","sef_mod_pending_comment":"mod-pending-comment","sef_mod_permissions":"mod-permissions","sef_mod_permission":"mod-permission","sef_root_cat":"root","sef_rss":"rss","sef_report":"report","sef_layout":"layout","sef_page":"page-","sef_all":"all","sef_new_listing":"new-listing","sef_comment":"comment","sef_component":"component","sef_file":"file","sef_raw_data":"raw-data","sef_space":"-","rss_display_icon":"1","rss_number_items_in_feed":10,"rss_show_thumbnail":"1","rss_thumbnail_source":"image","rss_thumbnail_alignment":"left","rss_email":"none","load_jquery":"2","load_jquery_ui":"2"}'; $db = JFactory::getDbo(); $query = 'UPDATE #__judirectory_categories SET config_params=' . $db->quote($defaultConfig) . ' WHERE id = ' . $rootCat->id; $db->setQuery($query); if ($db->execute()) { $this->setRedirect("index.php?option=com_judirectory&view=globalconfig&layout=edit", JText::_('COM_JUDIRECTORY_GLOBAL_CONFIG_RESET_DEFAULT_SUCCESS')); } else { $this->setRedirect("index.php?option=com_judirectory&view=globalconfig&layout=edit", JText::_('COM_JUDIRECTORY_GLOBAL_CONFIG_RESET_DEFAULT_FAILED')); } }
public function isEmptyCategory($categoryId) { $nestedCategories = JUDirectoryFrontHelperCategory::getCategoriesRecursive($categoryId, true, true, true, true, true, $getIdOnly = true); if (!is_array($nestedCategories) || empty($nestedCategories)) { return true; } $categoryObject = $nestedCategories[0]; if ($categoryObject->total_nested_categories > 0) { return false; } if ($categoryObject->total_listings > 0) { return false; } return true; }
public function display($tpl = null) { $app = JFactory::getApplication(); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $levelOptions = array(); $levelOptions[] = JHtml::_('select.option', 1, 1); $levelOptions[] = JHtml::_('select.option', 5, 5); $levelOptions[] = JHtml::_('select.option', 10, 10); $levelOptions[] = JHtml::_('select.option', 15, 15); $levelOptions[] = JHtml::_('select.option', 20, 20); $levelOptions[] = JHtml::_('select.option', 25, 25); $levelOptions[] = JHtml::_('select.option', 30, 30); $this->levelOptions = $levelOptions; $boolean = array(); $boolean[] = JHtml::_('select.option', 0, JText::_('JNO')); $boolean[] = JHtml::_('select.option', 1, JText::_('JYES')); $this->boolean = $boolean; $this->layout = $this->getLayout(); if ($this->layout == 'rebuildrating' || $this->layout == 'resizeimages') { $categoryList = $this->get('CategoryList'); foreach ($categoryList as $key => $value) { $categoryList[$key]->id = $value->id; $categoryList[$key]->title = '|— ' . $value->title; } $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); array_unshift($categoryList, array('id' => $rootCat->id, 'title' => 'Root')); $this->categoryList = $categoryList; } if ($this->layout == 'rebuildrating') { $this->criteriaGroups = $this->get("CriteriaGroups"); } $errors = $app->getUserState("import_file_errors"); if (isset($errors)) { $this->errors = $errors; $app->setUserState("import_file_errors", null); } $this->addToolBar(); if ($this->getLayout() == "rebuildrating") { $app->setUserState("cats", null); $app->setUserState('criteria_groups', null); $app->setUserState('total_listings', null); } parent::display($tpl); $this->setDocument(); }
protected function getInput() { $fieldgroup_id = $this->form->getValue('id'); $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $categoryTree = JUDirectoryHelper::getCategoryTree($rootCategory->id); $html = "<div id=\"categoriestoassignfieldgroup\" class=\"categoriestoassignfieldgroup\">"; if ($this->form->getValue('id') == 1) { $html .= '<input type="text" class="readonly" readonly="readonly" value="' . JText::_('JALL') . '"/>'; } else { $select_cat_class = 'select-cat'; $html .= '<div class="btn-group pull-left">'; $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>'; $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>'; $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>'; $html .= '</div>'; $html .= "<ul id=\"" . $this->id . "\" class=\"nav\">"; $html .= "<li>"; $html .= "<input id=\"catid-" . $rootCategory->id . "\" type=\"checkbox\" value=\"" . $rootCategory->id . "\" disabled=\"true\" />"; $html .= "<label for=\"catid-" . $rootCategory->id . "\">" . str_repeat('<span class="gi">|—</span>', $rootCategory->level) . $rootCategory->title . "</label>"; $html .= "</li>"; foreach ($categoryTree as $category) { if ($category->id == $rootCategory->id) { continue; } $link_edit_fieldgroup = ''; $html .= "<li>"; if ($category->selected_fieldgroup == -1 && $category->fieldgroup_id > 0) { $html .= "<span class=\"inherited-value\" title=\"" . JText::_("COM_JUDIRECTORY_INHERIT") . "\">" . JText::_('COM_JUDIRECTORY_INHERIT') . "</span>"; } elseif ($category->fieldgroup_id == $fieldgroup_id) { $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type=\"checkbox\" value=\"" . $category->id . "\" checked=\"checked\" name=\"" . $this->name . "[]\"/>"; } elseif ($category->fieldgroup_id > 0) { $link_edit_fieldgroup = "<span><a href=\"index.php?option=com_judirectory&task=fieldgroup.edit&id=" . $category->fieldgroup_id . "\" title=\"" . $this->getFieldGroupName($category->fieldgroup_id) . "\" >[" . $this->getFieldGroupName($category->fieldgroup_id) . "]</a></span>"; $html .= "<input id=\"catid-" . $category->id . "\" type=\"checkbox\" checked=\"checked\" value=\"" . $category->id . "\" disabled=\"true\" />"; } else { $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type=\"checkbox\" value=\"" . $category->id . "\" name=\"" . $this->name . "[]\"/>"; } $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level) . $category->title . "</label>"; $html .= $link_edit_fieldgroup; $html .= "</li>"; } $html .= "</ul>"; } $html .= "</div>"; return $html; }
public static function getRootPathway() { $app = JFactory::getApplication(); $menus = $app->getMenu('site'); $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory(); $needles = array('tree' => array((int) $categoryRoot->id)); $findMenuTreeRoot = JUDirectoryHelperRoute::findItemId($needles, true); $rootPathway = new stdClass(); if ($findMenuTreeRoot) { $menuTreeRoot = $menus->getItem($findMenuTreeRoot); $rootPathway->name = $menuTreeRoot->title; $rootPathway->link = JRoute::_($menuTreeRoot->link); } else { $rootPathway->name = html_entity_decode(JText::_('COM_JUDIRECTORY_ROOT'), ENT_COMPAT, 'UTF-8'); $rootPathway->link = JUDirectoryHelperRoute::getTreeRoute($categoryRoot->id); } return $rootPathway; }
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 function display($tpl = null) { $app = JFactory::getApplication(); $categoryId = $app->input->getInt('id', 1); $this->category = JUDirectoryFrontHelperCategory::getCategory($categoryId); $error = array(); if (!JUDirectoryFrontHelperPermission::canDoCategory($this->category->id, true, $error)) { $user = JFactory::getUser(); if ($user->id) { return JError::raiseError($error['code'], $error['message']); } else { $uri = JUri::getInstance(); $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false); $app = JFactory::getApplication(); $app->redirect($loginUrl, JText::_('COM_JUDIRECTORY_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning'); return false; } } $model = $this->getModel(); $this->model = $model; $this->state = $this->get('State'); $this->params = $this->state->params; if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->parent_id = $this->category->id; $this->subcategory_level = (int) $this->params->get('all_categories_subcategory_level', -1); $this->all_categories = $model->getCategoriesRecursive($this->category->id, $this->subcategory_level); $firstCategory = $this->all_categories[0]; $this->category->total_childs = $firstCategory->total_childs; $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx')); $this->_prepareDocument(); $this->_setBreadcrumb(); parent::display($tpl); }
public static function loadLanguageForTopLevelCat() { $app = JFactory::getApplication(); $view = $app->input->getString('view', ''); $id = $app->input->getInt('id', 0); if (isset($view)) { switch ($view) { case 'category': $topLevelCats = JUDirectoryHelper::getCatsByLevel(1, $id); break; case 'listing': $catId = JUDirectoryFrontHelperCategory::getMainCategoryId($id); $topLevelCats = JUDirectoryHelper::getCatsByLevel(1, $catId); break; } if (!empty($topLevelCats)) { $topLevelCat = $topLevelCats[0]; if ($view == 'category' || $view == 'listing') { JUDirectoryFrontHelperLanguage::loadLanguageFile('com_judirectory_' . $topLevelCat->id, JPATH_SITE); } } } return; }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $app = JFactory::getApplication(); $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $fastAddError = $app->getUserState('com_judirectory.categories.fastadderror'); $fastAddSuccess = $app->getUserState('com_judirectory.categories.fastaddsuccess'); $this->cat_id = $app->input->getInt('cat_id', $rootCat->id); $this->params = JUDirectoryHelper::getParams($this->cat_id); $this->canDoCat = JUDirectoryHelper::getActions('com_judirectory', 'category', $this->cat_id); $this->rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $this->allowAddListing = $this->params->get('allow_add_listing_to_root', 0) && $this->cat_id == $this->rootCat->id || $this->cat_id != $this->rootCat->id; $this->listingGroupCanDoManage = $this->groupCanDoCatManage = JUDirectoryHelper::checkGroupPermission("listing.edit"); $this->listingGroupCanDoDelete = $this->groupCanDoCatDelete = JUDirectoryHelper::checkGroupPermission("listings.delete"); $this->catGroupCanDoManage = $this->groupCanDoCatManage = JUDirectoryHelper::checkGroupPermission("category.edit"); $this->catGroupCanDoDelete = $this->groupCanDoCatDelete = JUDirectoryHelper::checkGroupPermission("categories.delete"); // if ($fastAddSuccess) { $app->enqueueMessage($fastAddSuccess); $app->setUserState('com_judirectory.categories.fastaddsuccess', ''); } if ($fastAddError) { $app->enqueueMessage($fastAddError, 'error'); $app->setUserState('com_judirectory.categories.fastadderror', ''); } $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->model = $this->getModel(); $this->addToolBar(); $this->setDocument(); parent::display($tpl); }
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; }
public function validateCriteria($data) { $listingId = $data['listing_id']; $params = JUDirectoryHelper::getParams(null, $listingId); $dataValid = array(); $canRateListing = JUDirectoryFrontHelperPermission::canRateListing($listingId); if ($canRateListing && $params->get('enable_listing_rate_in_comment_form', 1)) { $mainCatId = JUDirectoryFrontHelperCategory::getMainCategoryId($listingId); $criteriaArray = JUDirectoryFrontHelperCriteria::getCriteriasByCatId($mainCatId); $postCriteria = $data['criteria']; if (count($criteriaArray) > 0) { foreach ($criteriaArray as $key => $criteria) { if ($criteria->required) { if (isset($postCriteria[$criteria->id]) && $postCriteria[$criteria->id] > 0 && $postCriteria[$criteria->id] <= 10) { $criteria->value = $postCriteria[$criteria->id]; } else { echo JText::_('Invalid Field ' . $criteria->title); exit; } } else { if (isset($postCriteria[$criteria->id]) && $postCriteria[$criteria->id] > 0 && $postCriteria[$criteria->id] <= 10) { $criteria->value = $postCriteria[$criteria->id]; } else { unset($criteriaArray[$key]); } } } $dataValid['criteria_array'] = $criteriaArray; } else { if ($params->get('require_listing_rate_in_comment_form', 1)) { if ($data['judir_comment_rating_single'] <= 0 && $data['judir_comment_rating_single'] > 10) { return false; } $dataValid['ratingValue'] = $data['judir_comment_rating_single']; } } } return $dataValid; }
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}"); } }
* ------------------------------------------------------------------------ * * @copyright Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author JoomUltra Co., Ltd * @website http://www.joomultra.com * @----------------------------------------------------------------------@ */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.modal'); $app = JFactory::getApplication(); $db = JFactory::getDbo(); $user = JFactory::getUser(); $userId = $user->id; $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $cat_id = $app->input->getInt('cat_id', $rootCat->id); $listOrder_cat = $this->escape($this->state->get('filter.ordering_cat')); $listDirn_cat = $this->escape($this->state->get('filter.direction_cat')); $search_cat = $this->escape($this->state->get('filter.search_cat')); $saveOrder_cat = $listOrder_cat == 'lft' && $this->canDoCat->get('judir.category.edit.state'); $model = $this->getModel(); $list_cat = $model->getListCategory($cat_id, $listOrder_cat, $listDirn_cat); $ordering = $listOrder_cat == 'lft'; $this->ordering = array(); $intro_image_path = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("category_intro_image_directory", "media/com_judirectory/images/category/intro/"); $detail_image_path = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("category_detail_image_directory", "media/com_judirectory/images/category/detail/"); foreach ($list_cat as $cat) { $this->ordering[] = $cat->id; } $originalOrders = array();
public function checkin() { $app = JFactory::getApplication(); parent::checkin(); $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $cat_id = $app->input->getInt('cat_id', $rootCat->id); if ($app->input->getString('view', 'listcats') == 'treestructure') { $this->setRedirect("index.php?option=com_judirectory&view=treestructure"); } else { $this->setRedirect("index.php?option=com_judirectory&view={$this->view_list}&cat_id={$cat_id}"); } }
public static function getParams($catId = null, $listingId = null) { // If set listingId but don't set catId -> get catId by listingId if (!$catId && $listingId) { $listingObj = self::getListingById($listingId); if ($listingObj) { $catId = $listingObj->cat_id; } } // Only override if cat existed, override by params of top level cat // Find the top level category, assign to $catId if top level cat is found if ($catId) { $path = self::getCategoryPath($catId); $rootCat = $path[0]; } else { $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); } $catIdToGetParams = $rootCat->id; // Cache by catId $storeId = md5(__METHOD__ . "::{$catIdToGetParams}"); // Set params by top level catId(or root) if it has not already set if (!isset(self::$cache[$storeId])) { // Get global config params(of root cat) by default $registry = new JRegistry(); $registry->loadString($rootCat->config_params); // Override params from active menu if is a menu of component(Use merge to ignore empty string and null param value) $app = JFactory::getApplication(); $activeMenu = $app->getMenu()->getActive(); if ($activeMenu && $activeMenu->component == 'com_judirectory') { $registry->merge($activeMenu->params); } self::$cache[$storeId] = $registry; } return self::$cache[$storeId]; }
public function getListingsForRating(array $cats, array $criteriaGroups, $limit, $start) { $listingsCats = array(); $db = $this->getDbo(); $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $query = $db->getQuery(true); $query->select('id'); $query->from('#__judirectory_criterias_groups'); $query->where('published != 1'); $db->setQuery($query); $criteriaGroupsUnpublished = $db->loadColumn(); if (empty($cats[0]) || in_array($rootCat->id, $cats)) { $query = $db->getQuery(true); $query->select('id AS cat_id, parent_id, lft, rgt, level, selected_criteriagroup'); $query->from('#__judirectory_categories'); if (!empty($criteriaGroups) && !empty($criteriaGroups[0])) { $query->where('criteriagroup_id IN (' . implode(',', $criteriaGroups) . ')'); } if (!empty($criteriaGroupsUnpublished)) { $query->where('criteriagroup_id NOT IN (' . implode(',', $criteriaGroupsUnpublished) . ')'); } $db->setQuery($query); $groupCats = $db->loadObjectList(); if (!empty($groupCats)) { foreach ($groupCats as $group) { $listingsCats[] = $group->cat_id; } } } else { foreach ($cats as $cat) { $query = $db->getQuery(true); $query->select('lft, rgt'); $query->from('#__judirectory_categories'); $query->where('id = ' . $cat); $db->setQuery($query); $left_rigth = $db->loadObject(); if ($left_rigth) { $query = $db->getQuery(true); $query->select('id'); $query->from('#__judirectory_categories'); $query->where('lft >= ' . $left_rigth->lft); $query->where('rgt <= ' . $left_rigth->rgt); if (!empty($criteriaGroups) && !empty($criteriaGroups[0])) { $query->where('criteriagroup_id IN (' . implode(',', $criteriaGroups) . ')'); } if (!empty($criteriaGroupsUnpublished)) { $query->where('criteriagroup_id NOT IN (' . implode(',', $criteriaGroupsUnpublished) . ')'); } $db->setQuery($query); $subCats = $db->loadColumn(); if (!empty($subCats)) { $listingsCats = array_merge($listingsCats, $subCats); } } } } if (!empty($listingsCats)) { $query = "SELECT listing_id FROM #__judirectory_listings_xref WHERE cat_id IN (" . implode(',', $listingsCats) . ") ORDER BY listing_id"; if ($start == 0) { $db->setQuery($query); $allListings = $db->loadColumn(); $app = JFactory::getApplication(); $app->setUserState('total_listings', count($allListings)); } $query .= " LIMIT {$start},{$limit}"; $db->setQuery($query); $listingIds = $db->loadColumn(); return $listingIds; } else { return array(); } }
public function loadTemplate($tpl = null) { $this->_output = null; $app = JFactory::getApplication(); $template = JFactory::getApplication()->getTemplate(); if ($this->getName() == 'category' || $this->getName() == 'tree') { $layoutUrl = $app->input->getString('layout', ''); if (isset($layoutUrl) && $layoutUrl != '') { $layout = $layoutUrl; } else { $layout = null; } $catId = $app->input->getInt('id', 1); $layout = JUDirectoryFrontHelperCategory::getCategoryViewLayout($layout, $catId); $this->setLayout($layout); } elseif ($this->getName() == 'listing') { $layoutUrl = $app->input->getString('layout', ''); if (isset($layoutUrl) && $layoutUrl != '') { $layout = $layoutUrl; } else { $layout = null; } $listingId = $app->input->getInt('id', 0); if ($listingId > 0) { $layout = JUDirectoryFrontHelperListing::getListingViewLayout($layout, $listingId); $this->setLayout($layout); } } $layout = $this->getLayout(); $layoutTemplate = $this->getLayoutTemplate(); $file = isset($tpl) ? $layout . '_' . $tpl : $layout; $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file); $tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\\.-]/i', '', $tpl) : $tpl; $lang = JFactory::getLanguage(); $lang->load('tpl_' . $template, JPATH_BASE, null, false, false) || $lang->load('tpl_' . $template, JPATH_THEMES . "/{$template}", null, false, false); $component = JApplicationHelper::getComponentName(); $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $app = JFactory::getApplication(); $id = $app->input->getInt('id', 0); $user = JFactory::getUser(); if ($previewStyle = (int) $app->input->getInt('tplStyle', 0)) { if ($user->id == 0) { $uri = JUri::getInstance(); $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false); $app->enqueueMessage(JText::_("COM_JUDIRECTORY_YOU_MUST_LOGIN_AS_SUPER_ADMIN_TO_PREVIEW_TEMPLATE_STYLE"), 'Notice'); $app->redirect($loginUrl); return false; } else { if (!$user->authorise('core.admin', 'com_judirectory')) { $app->enqueueMessage(JText::_("COM_JUDIRECTORY_YOU_MUST_LOGIN_AS_SUPER_ADMIN_TO_PREVIEW_TEMPLATE_STYLE"), 'Notice'); } } } if ($user->authorise('core.admin', 'com_judirectory') && ($previewStyle = (int) $app->input->getInt('tplStyle', 0))) { $currentTemplateStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleObject($previewStyle); } else { $currentTemplateStyleObject = JUDirectoryFrontHelperTemplate::getCurrentTemplateStyle($this->getName(), $id); } $JUTemplate = trim($currentTemplateStyleObject->folder); $JUTemplate = strtolower($JUTemplate); $this->template_params = $currentTemplateStyleObject->params; if (!$JUTemplate) { $JUTemplate = 'default'; } $this->template = $JUTemplate; $JUTemplatePath = JUDirectoryFrontHelperTemplate::getTemplatePathWithoutRoot($currentTemplateStyleObject->template_id); $topLevelTemplate = $JUTemplatePath[0]->folder ? $JUTemplatePath[0]->folder : 'default'; $asset_file = JPATH_SITE . '/components/com_judirectory/templates/' . $topLevelTemplate . '/load_assets.php'; if (JFile::exists($asset_file)) { include_once $asset_file; } $JUTemplatePathFull = array(); $JUTemplatePathFull[] = $this->_basePath . '/templates/default/' . $this->getName(); $JUTemplatePathFull[] = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . 'default' . '/' . $this->getName(); $JUTemplatePath = array_reverse($JUTemplatePath); foreach ($JUTemplatePath as $JUTemplatePathItem) { $JUTemplatePathFull[] = $this->_basePath . '/templates/' . $JUTemplatePathItem->folder . '/' . $this->getName(); $JUTemplatePathFull[] = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $JUTemplatePathItem->folder . '/' . $this->getName(); } foreach ($JUTemplatePathFull as $item) { $this->_addPath('template', $item); } if (isset($layoutTemplate) && $layoutTemplate != '_' && $layoutTemplate != $template) { $this->_path['template'] = str_replace($template, $layoutTemplate, $this->_path['template']); } $jversion_arr = explode(".", JVERSION); $priVersion = $jversion_arr[0]; $subVersion = $jversion_arr[1]; $fileToFind = $this->_createFileName('template', array('name' => $file . '.j' . $priVersion . $subVersion)); $this->_template = JPath::find($this->_path['template'], $fileToFind); if ($this->_template == false) { $fileToFind = $this->_createFileName('template', array('name' => $file . '.j' . $priVersion . 'x')); $this->_template = JPath::find($this->_path['template'], $fileToFind); } if ($this->_template == false) { $fileToFind = $this->_createFileName('template', array('name' => $file)); $this->_template = JPath::find($this->_path['template'], $fileToFind); } if ($this->_template == false) { $fallbackPaths = array(); $fallbackPaths[] = $this->_basePath . '/templates/default/' . $this->getName(); $fallbackPaths[] = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . 'default' . '/' . $this->getName(); foreach ($fallbackPaths as $fallbackPath) { $fallbackPath = trim($fallbackPath); if (substr($fallbackPath, -1) != DIRECTORY_SEPARATOR) { $fallbackPath .= DIRECTORY_SEPARATOR; } array_unshift($fallbackPaths, $fallbackPath); } $fileToFind = $this->_createFileName('', array('name' => 'default.j' . $priVersion . $subVersion . (isset($tpl) ? '_' . $tpl : $tpl))); $this->_template = JPath::find($fallbackPaths, $fileToFind); if ($this->_template == false) { $fileToFind = $this->_createFileName('', array('name' => 'default.j' . $priVersion . 'x' . (isset($tpl) ? '_' . $tpl : $tpl))); $this->_template = JPath::find($fallbackPaths, $fileToFind); } if ($this->_template == false) { $fileToFind = $this->_createFileName('', array('name' => 'default' . (isset($tpl) ? '_' . $tpl : $tpl))); $this->_template = JPath::find($fallbackPaths, $fileToFind); } } if ($this->_template != false) { unset($tpl); unset($file); if (isset($this->this)) { unset($this->this); } ob_start(); include $this->_template; $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; } else { return JError::raiseError(500, JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file)); } }
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 static function getCurrentTemplateStyle($view = '', $id = null) { $app = JFactory::getApplication(); $jInput = $app->input; if (!$view) { $view = $jInput->getString('view', ''); } if ($jInput->getString('option', '') != 'com_judirectory') { $view = ''; } if (!$id) { switch ($view) { case 'form': $id = $jInput->getInt('id', 0); $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $cat_id = $jInput->getInt('cat_id', $rootCategory->id); break; case 'listing': $id = $jInput->getInt('id', 0); break; case 'category': $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $id = $jInput->getInt('id', $rootCategory->id); break; } } switch ($view) { case 'form': if ($id) { $templateStyleObject = self::getTemplateStyleOfListing($id); $listingObject = JUDirectoryHelper::getListingById($id); $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $listingObject->template_params); } else { $templateStyleObject = self::getTemplateStyleOfCategory($cat_id); $categoryObject = JUDirectoryHelper::getCategoryById($cat_id); $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $categoryObject->template_params); } break; case 'listing': $templateStyleObject = self::getTemplateStyleOfListing($id); $listingObject = JUDirectoryHelper::getListingById($id); $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $listingObject->template_params); break; case 'category': $templateStyleObject = self::getTemplateStyleOfCategory($id); $categoryObject = JUDirectoryHelper::getCategoryById($id); $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $categoryObject->template_params); break; default: $templateStyleObject = self::getDefaultTemplateStyle(); $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id); break; } return $templateStyleObject; }
public function delete($pk = null) { JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables'); $k = $this->_tbl_key; $pk = is_null($pk) ? $this->{$k} : $pk; $db = JFactory::getDbo(); $query = "DELETE FROM #__judirectory_subscriptions WHERE item_id = {$pk} AND type = 'listing'"; $db->setQuery($query); $db->execute(); $query = "SELECT * FROM #__judirectory_comments WHERE listing_id = " . $pk; $db->setQuery($query); $commentIds = $db->loadColumn(); if ($commentIds) { $commentTable = JTable::getInstance("Comment", "JUDirectoryTable"); foreach ($commentIds as $commentId) { $commentTable->delete($commentId); } } $query = "SELECT id FROM #__judirectory_rating WHERE listing_id = {$pk}"; $db->setQuery($query); $ratingItemIds = $db->loadColumn(); if ($ratingItemIds) { $ratingTable = JTable::getInstance("Rating", "JUDirectoryTable"); foreach ($ratingItemIds as $ratingItemId) { $ratingTable->delete($ratingItemId); } } $query = "DELETE FROM #__judirectory_reports WHERE item_id = {$pk} AND type = 'listing'"; $db->setQuery($query); $db->execute(); $query = "SELECT id FROM #__judirectory_collections_items WHERE listing_id = {$pk}"; $db->setQuery($query); $collectionItemIds = $db->loadColumn(); if ($collectionItemIds) { $collectionItemTable = JTable::getInstance("CollectionItem", "JUDirectoryTable"); foreach ($collectionItemIds as $collectionItemId) { $collectionItemTable->delete($collectionItemId); } } JUDirectoryHelper::deleteLogs('listing', $pk); $query = "DELETE FROM #__judirectory_mailqs\n\t\t\t WHERE item_id =" . $pk . "\n\t\t\t\t\t\tAND email_id IN (SELECT id FROM #__judirectory_emails WHERE (`event` LIKE 'listing.%' AND `event` != 'listing.delete'))"; $db->setQuery($query); $db->execute(); $query = $db->getQuery(true); $query->select('id'); $query->from('#__judirectory_listings'); $query->where('approved=' . -$pk); $db->setQuery($query); $tempListingIds = $db->loadColumn(); if (count($tempListingIds)) { foreach ($tempListingIds as $tempListingId) { $this->deleteMainData($tempListingId, true); } } $cat_id = JUDirectoryFrontHelperCategory::getMainCategoryId($this->id); $this->deleteMainData($pk); if (parent::delete($pk)) { $app = JFactory::getApplication(); if ($app->isSite()) { $registry = new JRegistry(); $registry->loadObject($this); $mailData = $registry->toArray(); $mailData['cat_id'] = $cat_id; if ($this->approved < 1) { JUDirectoryFrontHelperMail::sendEmailByEvent('listing.reject', $this->id, $mailData); } else { JUDirectoryFrontHelperMail::sendEmailByEvent('listing.delete', $this->id, $mailData); } } return true; } else { return false; } }
public static function getFeed($feedListings, &$document) { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $params = JUDirectoryHelper::getParams(); $image = $params->get('rss_thumbnail_source', 'image'); $feedEmail = $params->get('rss_email', 'none'); $siteEmail = $app->get('mailfrom'); foreach ($feedListings as $listing) { $title = $listing->title; $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); $categoryId = JUDirectoryFrontHelperCategory::getMainCategoryId($listing->id); $category = JUDirectoryFrontHelperCategory::getCategory($categoryId); $feedItem = new JFeedItem(); $feedItem->title = $title; $feedItem->link = JRoute::_(JUDirectoryHelperRoute::getListingRoute($listing->id)); if ($feedEmail != 'none') { $user = JFactory::getUser($listing->created_by); $feedItem->author = $listing->created_by_alias ? $listing->created_by_alias : $user->name; if ($feedEmail == 'site') { $feedItem->authorEmail = $siteEmail; } elseif ($feedEmail === 'author') { $feedItem->authorEmail = $listing->email ? $listing->email : $user->email; } } $feedItem->category = $category->title; @($date = $listing->publish_up ? date('r', strtotime($listing->publish_up)) : ''); $feedItem->date = $date; $feedItem->description = ""; if ($params->get('rss_show_thumbnail', 1)) { if ($image == 'image' && $listing->image) { $imageUrl = JUDirectoryHelper::getListingImage($listing->image); } else { $query = "SELECT file_name FROM #__judirectory_images WHERE listing_id = " . $listing->id . " ORDER BY ordering ASC LIMIT 1"; $db->setQuery($query); $firstImage = $db->loadResult(); $imageUrl = JUri::root() . JUDirectoryFrontHelper::getDirectory("listing_small_image_directory", "media/com_judirectory/images/gallery/small/", true) . $firstImage; } $feedItem->description = "<img src='" . $imageUrl . "' align=\"" . $params->get('rss_thumbnail_alignment', 'left') . "\" />"; } $feedItem->description .= $listing->introtext; $document->addItem($feedItem); } }
protected function getInput() { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $style_id = $app->input->getInt('id', 0); $db->setQuery("SELECT id FROM #__judirectory_categories WHERE style_id = " . $style_id); $catIds = $db->loadColumn(); $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory(); $categoryTree = JUDirectoryHelper::getCategoryTree($rootCategory->id); $html = "<div id=\"categoriestoassignstyle\" class=\"categoriestoassignstyle\">"; $select_cat_class = 'select-cat'; $html .= '<div class="btn-group pull-left">'; $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>'; $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>'; $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>'; $html .= '</div>'; $html .= "<ul class=\"nav\" id=\"" . $this->id . "\">"; foreach ($categoryTree as $category) { $html .= "<li>"; $cat_style_id = ""; if ($category->id == 1) { $cat_style_id = $category->style_id; $inherit = ""; } elseif ($category->style_id == $style_id) { $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "' checked>"; $cat_style_id = $style_id; $inherit = ""; } elseif ($category->style_id == -1) { $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'"; $db->setQuery("SELECT id FROM #__judirectory_categories WHERE lft <" . $category->lft . " AND rgt > " . $category->rgt); $parentCatIds = $db->loadColumn(); $parentCatIds = array_reverse($parentCatIds); if (is_array($catIds) && !empty($catIds)) { foreach ($parentCatIds as $parentCatId) { if (in_array($parentCatId, $catIds)) { $html .= " checked"; } } } $html .= ">"; foreach ($parentCatIds as $parentCatId) { $styleId = $this->getStyleIdByCategoryId($parentCatId); if ($styleId > -1 || $styleId == -2) { $cat_style_id = $styleId; break; } } $inherit = "<span class=\"inherited-value\" title=\"" . JText::_("COM_JUDIRECTORY_INHERIT") . "\">" . JText::_("COM_JUDIRECTORY_INHERIT") . "</span>"; } elseif ($category->style_id == -2) { $html .= "<input type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'>"; $inherit = ""; $db->setQuery("SELECT id FROM #__judirectory_template_styles WHERE home = 1"); $cat_style_id = $db->loadResult(); } else { $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "' />"; $inherit = ""; $cat_style_id = $category->style_id; } if ($cat_style_id == -2) { $style_title = $this->getStyleTitle(0, true); } else { $style_title = $this->getStyleTitle($cat_style_id); } $style_title = $style_title ? " [" . $style_title . "] " : ""; $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level); if ($category->id == 1) { $html .= $category->title; } else { $html .= "<a href=\"" . JRoute::_('index.php?option=com_judirectory&task=category.edit&id=' . $category->id) . "\">" . $category->title . "</a>"; } $html .= " <span class=\"style-title\">" . $style_title . "</span>" . $inherit . "</label>"; $html .= "</li>"; } $html .= "</ul>"; $html .= "</div>"; return $html; }
protected function populateState($ordering = null, $direction = null) { $rootCat = JUDirectoryFrontHelperCategory::getRootCategory(); $cat_id = $this->getUserStateFromRequest($this->context . '.cat_id', 'cat_id', $rootCat->id); $this->setState('list.cat_id', $cat_id); $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $search = $this->getUserStateFromRequest($this->context . '.filter.search_cat', 'filter_search_cat'); $this->setState('filter.search_cat', $search); $search = $this->getUserStateFromRequest($this->context . '.filter.simple_search', 'simple_search'); $this->setState('filter.simple_search', $search); $search_in = $this->getUserStateFromRequest($this->context . '.filter.search_in', 'search_in', 'listings', 'none', false); $this->setState('filter.search_in', $search_in); $ordering = $this->getUserStateFromRequest($this->context . '.filter.ordering_cat', 'filter_order_cat'); if (empty($ordering)) { $this->setState('filter.ordering_cat', 'lft'); } else { $this->setState('filter.ordering_cat', $ordering); } $direction = $this->getUserStateFromRequest($this->context . '.filter.direction_cat', 'filter_order_Dir_cat'); if (empty($direction)) { $this->setState('filter.direction_cat', 'asc'); } else { $this->setState('filter.direction_cat', $direction); } parent::populateState($ordering, $direction); }
protected function _setBreadcrumb() { $categoryId = JUDirectoryFrontHelperCategory::getMainCategoryId($this->item->id); $app = JFactory::getApplication(); $pathway = $app->getPathway(); $pathwayArray = array(); if ($categoryId) { $pathwayArray = JUDirectoryFrontHelperBreadcrumb::getBreadcrumbCategory($categoryId); } else { $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::getRootPathway(); } $linkListing = JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->item->id)); $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::createPathwayItem($this->item->title, $linkListing); if ($this->_layout == 'print') { $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::createPathwayItem('PRINT'); $document = JFactory::getDocument(); $document->setMetaData('robots', 'noindex, nofollow'); } $pathway->setPathway($pathwayArray); }
public static function getListingLayout($listingId) { $storeId = md5(__METHOD__ . "::" . $listingId); if (!isset(self::$cache[$storeId])) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('layout'); $query->from('#__judirectory_listings'); $query->where('id =' . $listingId); $db->setQuery($query); $layout = $db->loadResult(); if ($layout == -2) { $params = JUDirectoryHelper::getParams(null, $listingId); $layout = $params->get('layout_listing', '_:default'); } elseif ($layout == -1) { $parentId = (int) JUDirectoryFrontHelperCategory::getMainCategoryId($listingId); if ($parentId == 0) { $params = JUDirectoryHelper::getParams(null, $listingId); $layout = $params->get('layout_listing', '_:default'); } else { $layout = JUDirectoryFrontHelperListing::getListingLayoutFromCategory($parentId); } } else { $layout = trim($layout); } self::$cache[$storeId] = $layout; } return self::$cache[$storeId]; }