当前位置: 首页>>代码示例>>PHP>>正文


PHP JUDirectoryHelper::getAddressTree方法代码示例

本文整理汇总了PHP中JUDirectoryHelper::getAddressTree方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::getAddressTree方法的具体用法?PHP JUDirectoryHelper::getAddressTree怎么用?PHP JUDirectoryHelper::getAddressTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUDirectoryHelper的用法示例。


在下文中一共展示了JUDirectoryHelper::getAddressTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onSearch

 public function onSearch(&$query, &$where, $search)
 {
     if ($search !== "") {
         $_query = array();
         $searchColumns = array('address', 'postcode', 'description');
         $db = JFactory::getDbo();
         foreach ($searchColumns as $searchColumn) {
             if (isset($search[$searchColumn]) && $search[$searchColumn] !== '') {
                 $_query[] = $db->quoteName($searchColumn) . " LIKE " . $db->quote("%" . $search[$searchColumn] . "%");
             }
         }
         $addressIds = array();
         if (isset($search['address_id']) && $search['address_id'] > 1) {
             $addresses = JUDirectoryHelper::getAddressTree($search['address_id'], true, true);
             if ($addresses) {
                 foreach ($addresses as $address) {
                     $addressIds[] = $address->id;
                 }
             }
         }
         if ($addressIds) {
             $_query[] = 'address.id IN (' . implode(',', $db->quote($addressIds)) . ')';
         }
         if ($_query) {
             $query->join('LEFT', '#__judirectory_locations AS location ON location.listing_id = listing.id');
             if ($addressIds) {
                 $query->join('LEFT', '#__judirectory_addresses AS address ON address.id = location.address_id');
             }
             $search_operator = $this->params->get("search_operator", 0);
             if ($search_operator == 0) {
                 $search_operator = $search['condition'];
             }
             $condition = $search_operator == 1 ? 'AND' : 'OR';
             $where[] = '(' . implode($_query, ' ' . $condition . ' ') . ')';
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:37,代码来源:core_locations.php


注:本文中的JUDirectoryHelper::getAddressTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。