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


PHP Model_Location::gen_seoname方法代码示例

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


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

示例1: action_geonames

 /**
  * Import multiple locations from geonames
  * @return void      
  */
 public function action_geonames()
 {
     $this->template->title = __('Geonames');
     $this->template->scripts['footer'][] = URL::base('http') . 'themes/default/js/oc-panel/locations-geonames.js';
     $location = NULL;
     if (intval(Core::get('id_location')) > 0) {
         $location = new Model_Location(Core::get('id_location'));
         if ($location->loaded()) {
             Breadcrumbs::add(Breadcrumb::factory()->set_title($location->name)->set_url(Route::url('oc-panel', array('controller' => 'location', 'action' => 'geonames')) . '?id_location=' . $location->id_location));
         } else {
             Alert::set(Alert::ERROR, __('You are selecting a location that does not exist'));
             $this->redirect(Route::get($this->_route_name)->uri(array('controller' => Request::current()->controller())));
         }
     }
     //update the elements related to that ad
     if (core::post('geonames_locations') !== "") {
         $geonames_locations = json_decode(core::post('geonames_locations'));
         if (count($geonames_locations) > 0) {
             $obj_location = new Model_Location();
             $locations_array = array();
             $insert = DB::insert('locations', array('name', 'seoname', 'id_location_parent', 'latitude', 'longitude', 'id_geoname', 'fcodename_geoname', 'order'));
             $i = 1;
             $execute = FALSE;
             foreach ($geonames_locations as $location) {
                 if (!empty($location->name) and !in_array($location->seoname = $obj_location->gen_seoname($location->name), $locations_array)) {
                     $execute = TRUE;
                     $insert = $insert->values(array($location->name, $location->seoname, Core::get('id_location', 1), isset($location->lat) ? $location->lat : NULL, isset($location->long) ? $location->long : NULL, isset($location->id_geoname) ? $location->id_geoname : NULL, isset($location->fcodename_geoname) ? $location->fcodename_geoname : NULL, $i));
                     $locations_array[] = $location->seoname;
                     $i++;
                 }
             }
             // Insert everything with one query.
             if ($execute == TRUE) {
                 $insert->execute();
                 Core::delete_cache();
             }
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'location', 'action' => 'index')) . '?id_location=' . Core::get('id_location', 1));
         }
     } else {
         Alert::set(Alert::INFO, __('Select some locations first.'));
     }
     $this->template->content = View::factory('oc-panel/pages/locations/geonames', array('location' => $location));
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:47,代码来源:location.php

示例2: action_geonames_locations

 /**
  * Import multiple locations from geonames
  * @return void      
  */
 public function action_geonames_locations()
 {
     $this->auto_render = FALSE;
     //update the elements related to that ad
     if (core::post('geonames_locations') !== "") {
         $geonames_locations = json_decode(core::post('geonames_locations'));
         if (count($geonames_locations) > 0) {
             $obj_location = new Model_Location();
             $locations_array = array();
             $insert = DB::insert('locations', array('name', 'seoname', 'id_location_parent', 'latitude', 'longitude', 'order'));
             $i = 1;
             foreach ($geonames_locations as $location) {
                 if (!in_array($location->seoname = $obj_location->gen_seoname($location->name), $locations_array)) {
                     $insert = $insert->values(array($location->name, $location->seoname, Core::get('id_location', 1), isset($location->lat) ? $location->lat : NULL, isset($location->long) ? $location->long : NULL, $i));
                     $locations_array[] = $location->seoname;
                     $i++;
                 }
             }
             // Insert everything with one query.
             $insert->execute();
             Core::delete_cache();
         }
     } else {
         Alert::set(Alert::INFO, __('Select some locations first.'));
     }
     HTTP::redirect(Route::url('oc-panel', array('controller' => 'location', 'action' => 'index')) . '?id_location=' . Core::get('id_location', 1));
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:31,代码来源:location.php


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