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


PHP Model_Location类代码示例

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


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

示例1: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     $loc = new Model_Location();
     // loaded category
     if (Controller::$location !== NULL) {
         if (Controller::$location->loaded()) {
             $location = Controller::$location->id_location;
             // id_location
             //list of children of current location
             // if list_loc dosent have siblings take brothers //
             $list_loc = $loc->where('id_location_parent', '=', $location)->order_by('order', 'asc')->cached()->find_all();
             if (count($list_loc) == 0) {
                 $list_loc = $loc->where('id_location_parent', '=', Controller::$location->id_location_parent)->order_by('order', 'asc')->cached()->find_all();
             }
             //parent of current location
             $loc_parent_deep = $loc->where('id_location', '=', Controller::$location->id_location_parent)->limit(1)->find();
             // array with name and seoname of a location and his parent. Is to build breadcrumb in widget
             $current_and_parent = array('name' => Controller::$location->name, 'id' => Controller::$location->id_location, 'seoname' => Controller::$location->seoname, 'parent_name' => $loc_parent_deep->name, 'id_parent' => $loc_parent_deep->id_location_parent, 'parent_seoname' => $loc_parent_deep->seoname);
         }
     } else {
         $list_loc = $loc->where('id_location_parent', '=', 1)->order_by('order', 'asc')->cached()->find_all();
         $current_and_parent = NULL;
     }
     $this->locations = $this->locations;
     $this->loc_items = $list_loc;
     $this->loc_breadcrumb = $current_and_parent;
     $this->cat_seoname = NULL;
     if (Controller::$category !== NULL) {
         if (Controller::$category->loaded()) {
             $this->cat_seoname = Controller::$category->seoname;
         }
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:39,代码来源:locations.php

示例2: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     if (is_numeric($user_id_location = Cookie::get('user_location'))) {
         $user_location = new Model_Location($user_id_location);
         if ($user_location->loaded()) {
             $this->location = $user_location;
         }
     }
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:15,代码来源:userlocation.php

示例3: addLocation

 /**
  * Add New Location 
  * 
  * @param   array      $locationParts      Array of Location Parts
  * @return  bool | int
  */
 public function addLocation($locationParts)
 {
     $newLocation = new Model_Location();
     $newLocation->fromArray($locationParts);
     try {
         $newLocation->save();
     } catch (Doctrine_Exception $e) {
         return $e->getMessage();
     }
     return $newLocation->id;
 }
开发者ID:royaltyclubvp,项目名称:BuzzyGals,代码行数:17,代码来源:Location.php

示例4: update_location

 private function update_location($sub, $ip)
 {
     $rack = $ip->network->device->racks;
     $room = $rack->rooms;
     $floor = $room->floors;
     $building = $floor->buildings;
     $loc = Model_Location::find()->where('rack', $rack['id'])->where('node', $sub->id)->get_one();
     if (!$loc) {
         $in = array('node' => $sub->id, 'type' => 0, 'building' => $building['id'], 'floor' => $floor['id'], 'room' => $room['id'], 'rack' => $rack['id'], 'pos_from' => 1, 'pos_to' => $rack['size']);
         $location = new Model_Location($in);
         $location->save();
     }
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:13,代码来源:test.php

示例5: before

 /**
  * Initialize properties before running the controller methods (actions),
  * so they are available to our action.
  */
 public function before($template = NULL)
 {
     parent::before();
     Theme::checker();
     $this->maintenance();
     /**
      * selected category
      */
     if ($this->request->param('category', NULL) != 'all') {
         $slug_cat = new Model_Category();
         $seo_cat = $slug_cat->where('seoname', '=', $this->request->param('category'))->limit(1)->cached()->find();
         if ($seo_cat->loaded()) {
             self::$category = $seo_cat;
         }
     }
     /**
      * selected location
      */
     if ($this->request->param('location', NULL) != NULL || $this->request->param('location') != 'all') {
         $slug_loc = new Model_Location();
         $seo_loc = $slug_loc->where('seoname', '=', $this->request->param('location'))->limit(1)->cached()->find();
         if ($seo_loc->loaded()) {
             self::$location = $seo_loc;
         }
     }
     if ($this->auto_render === TRUE) {
         // Load the template
         if ($template !== NULL) {
             $this->template = $template;
         }
         $this->template = View::factory($this->template);
         // Initialize template values
         $this->template->title = core::config('general.site_name');
         $this->template->meta_keywords = '';
         $this->template->meta_description = '';
         $this->template->meta_copywrite = 'Open Classifieds ' . Core::version;
         $this->template->content = '';
         $this->template->styles = array();
         $this->template->scripts = array();
         //we can not cache this view since theres dynamic parts
         //$this->template->header  = View::factory('header');
         //setting inner views try to get from fragment
         // if (Auth::instance()->logged_in())
         //     $this->template->header  = View::fragment('header_front_login','header');
         // else
         $this->template->header = View::factory('header');
         //             $this->template->header  = View::fragment('header_front','header');
         //no fragment since CSRF gets cached :(
         $this->template->footer = View::fragment('footer_front', 'footer');
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:55,代码来源:controller.php

示例6: _storeZip

 protected function _storeZip(Garp_Service_PostcodeNl_Zipcode &$zip, $key, $overwrite)
 {
     $model = new Model_Location();
     $select = $model->select()->where('zip = ? AND number IS NULL', $zip->zipcode);
     $existingRow = $model->fetchRow($select);
     if ($existingRow && $overwrite) {
         $model->delete('id = ' . $existingRow->id);
     }
     if (!$existingRow || $overwrite) {
         $this->_insertZip($zip, $model);
     }
     $this->_progress->advance();
     $this->_progress->display('Importing zip codes', '%s left');
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:14,代码来源:PostcodeNl.php

示例7: action_index

 public function action_index()
 {
     $this->auto_render = FALSE;
     $info = array('title' => 'RSS ' . htmlspecialchars(Core::config('general.site_name')), 'pubDate' => date("r"), 'description' => __('Latest published'), 'generator' => 'Open Classifieds');
     $items = array();
     //last ads, you can modify this value at: advertisement.feed_elements
     $ads = new Model_Ad();
     $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED)->order_by('published', 'desc')->limit(Core::config('advertisement.feed_elements'));
     //filter by category aor location
     if (Model_Category::current()->loaded()) {
         $ads->where('id_category', '=', Model_Category::current()->id_category);
     }
     if (Model_Location::current()->loaded()) {
         $ads->where('id_location', '=', Model_Location::current()->id_location);
     }
     $ads = $ads->cached()->find_all();
     foreach ($ads as $a) {
         $url = Route::url('ad', array('category' => $a->category->seoname, 'seotitle' => $a->seotitle));
         $item = array('title' => htmlspecialchars($a->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($a->published), 'description' => htmlspecialchars(Text::removebbcode($a->description), ENT_QUOTES), 'guid' => $url);
         if ($a->get_first_image() !== NULL) {
             $item['description'] = '<img src="' . $a->get_first_image() . '" />' . $item['description'];
         }
         $items[] = $item;
     }
     $xml = Feed::create($info, $items);
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:28,代码来源:feed.php

示例8: action_moderate

 /**
  * Action MODERATION
  */
 public function action_moderate()
 {
     //template header
     $this->template->title = __('Moderation');
     $this->template->meta_description = __('Moderation');
     $this->template->scripts['footer'][] = '/js/oc-panel/moderation.js';
     //find all tables
     $ads = new Model_Ad();
     $res_count = $ads->where('status', '=', Model_Ad::STATUS_NOPUBLISHED)->count_all();
     if ($res_count > 0) {
         $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count, 'items_per_page' => core::config('general.advertisements_per_page')))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
         $ads = $ads->where('ad.status', '=', Model_Ad::STATUS_NOPUBLISHED)->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
         //find all tables
         $hits = new Model_Visit();
         $hits->find_all();
         $list_cat = Model_Category::get_all();
         $list_loc = Model_Location::get_all();
         $arr_hits = array();
         // array of hit integers
         // fill array with hit integers
         foreach ($ads as $key_ads) {
             // match hits with ad
             $h = $hits->where('id_ad', '=', $key_ads->id_ad);
             $count = count($h->find_all());
             // count individual hits
             array_push($arr_hits, $count);
         }
         $this->template->content = View::factory('oc-panel/pages/moderate', array('ads' => $ads, 'pagination' => $pagination, 'category' => $list_cat, 'location' => $list_loc, 'hits' => $arr_hits));
         // create view, and insert list with data
     } else {
         Alert::set(Alert::INFO, __('You do not have any advertisements waiting to be published'));
         $this->template->content = View::factory('oc-panel/pages/moderate', array('ads' => NULL));
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:37,代码来源:ad.php

示例9: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     $cat = new Model_Category();
     // loaded category
     if (Model_Category::current()->loaded()) {
         $category = Model_Category::current()->id_category;
         // id_category
         //list of children of current category
         // if list_cat dosent have siblings take brothers
         $list_cat = $cat->where('id_category_parent', '=', $category)->order_by('order', 'asc')->cached()->find_all();
         if (count($list_cat) == 0) {
             $list_cat = $cat->where('id_category_parent', '=', Model_Category::current()->id_category_parent)->order_by('order', 'asc')->cached()->find_all();
         }
         //parent of current category
         $cat_parent_deep = $cat->where('id_category', '=', Model_Category::current()->id_category_parent)->limit(1)->find();
         // array with name and seoname of a category and his parent. Is to build breadcrumb in widget
         $current_and_parent = array('name' => Model_Category::current()->name, 'id' => Model_Category::current()->id_category, 'seoname' => Model_Category::current()->seoname, 'parent_name' => $cat_parent_deep->name, 'id_parent' => $cat_parent_deep->id_category_parent, 'parent_seoname' => $cat_parent_deep->seoname);
     } else {
         $list_cat = $cat->where('id_category_parent', '=', 1)->order_by('order', 'asc')->cached()->find_all();
         $current_and_parent = NULL;
     }
     $this->cat_items = $list_cat;
     $this->cat_breadcrumb = $current_and_parent;
     $this->loc_seoname = NULL;
     if (Model_Location::current()->loaded()) {
         if (Model_Location::current()->id_location != 1) {
             $this->loc_seoname = Model_Location::current()->seoname;
         }
     }
 }
开发者ID:zhangkom,项目名称:openclassifieds2,代码行数:36,代码来源:categories.php

示例10: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     // get all categories
     if ($this->advanced != FALSE) {
         $this->cat_items = Model_Category::get_as_array();
         $this->cat_order_items = Model_Category::get_multidimensional();
         $this->selected_category = NULL;
         if (core::request('category')) {
             $this->selected_category = core::request('category');
         } elseif (Model_Category::current()->loaded()) {
             $this->selected_category = core::config('general.search_multi_catloc') ? array(Model_Category::current()->seoname) : Model_Category::current()->seoname;
         }
         // get all locations
         $this->loc_items = Model_Location::get_as_array();
         $this->loc_order_items = Model_Location::get_multidimensional();
         $this->selected_location = NULL;
         if (core::request('location')) {
             $this->selected_location = core::request('location');
         } elseif (Model_Location::current()->loaded()) {
             $this->selected_location = core::config('general.search_multi_catloc') ? array(Model_Location::current()->seoname) : Model_Location::current()->seoname;
         }
     }
     if ($this->custom != FALSE) {
         $fields = Model_Field::get_all();
         $this->custom_fields = $fields;
     }
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:33,代码来源:search.php

示例11: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     // get all categories
     if ($this->categories != FALSE) {
         $this->cat_items = Model_Category::get_as_array();
         $this->cat_order_items = Model_Category::get_multidimensional();
     }
     // get all locations
     if ($this->locations != FALSE) {
         $this->loc_items = Model_Location::get_as_array();
         $this->loc_order_items = Model_Location::get_multidimensional();
     }
     if ($this->price != FALSE) {
         $this->price = TRUE;
     }
     // user
     if (Auth::instance()->logged_in()) {
         //subscriber
         // check if user is already subscribed
         $user_id = Auth::instance()->get_user()->id_user;
         $obj_subscriber = new Model_Subscribe();
         $subscriber = $obj_subscriber->where('id_user', '=', $user_id)->limit(1)->find();
         if ($subscriber->loaded()) {
             $this->subscriber = TRUE;
         }
         //if user logged in pass email and id
         $this->user_email = Auth::instance()->get_user()->email;
         $this->user_id = $user_id;
     } else {
         $this->user_id = 0;
     }
     //min - max price selected
     $this->min_price = $this->min_price;
     $this->max_price = $this->max_price;
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:41,代码来源:subscribers.php

示例12: setUp

 public function setUp()
 {
     $this->pass = Model_Pass::forge(array('name' => 'test name', 'description' => 'desc', 'logo_text' => 'sample', 'barcode_message' => 'message', 'barcode_format' => 0));
     $this->pass->locations[] = Model_Location::forge(array('latitude' => 1.01, 'longitude' => 1.02));
     $this->pass->locations[] = Model_Location::forge(array('latitude' => 2.03, 'longitude' => 2.04, 'altitude' => 2.05, 'relevant_text' => 'text'));
     $this->pass->save();
 }
开发者ID:rizumita,项目名称:PassCurrent,代码行数:7,代码来源:pass_test.php

示例13: view

 /**
  * view method
  *
  * @access public
  * @return void
  * @author ida
  */
 public function view()
 {
     $this->fleamarket_id = \Input::param('fleamarket_id');
     $this->prefectures = \Config::get('master.prefectures');
     $this->entry_styles = \Config::get('master.entry_styles');
     $this->event_statuses = \Model_Fleamarket::getEventStatuses();
     $this->locations = \Model_Location::find('all');
     $this->link_from_list = $this->getLinkFromList();
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:16,代码来源:index.php

示例14: action_index

 public function action_index()
 {
     if (core::config('general.auto_locate')) {
         Theme::$scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7';
         Theme::$scripts['footer'][] = '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js';
     }
     //template header
     $this->template->title = '';
     // $this->template->meta_keywords    = 'keywords';
     if (core::config('general.site_description') != '') {
         $this->template->meta_description = core::config('general.site_description');
     } else {
         $this->template->meta_description = core::config('general.site_name') . ' ' . __('official homepage, get your post listed now.');
     }
     //setting main view/template and render pages
     // swith to decide on ads_in_home
     $ads = new Model_Ad();
     $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
     $ads_in_home = core::config('advertisement.ads_in_home');
     //in case we do not count visits we cant show popular
     if (core::config('advertisement.count_visits') == 0 and $ads_in_home == 2) {
         $ads_in_home = 0;
     }
     switch ($ads_in_home) {
         case 2:
             $id_ads = array_keys(Model_Visit::popular_ads());
             if (count($id_ads) > 0) {
                 $ads->where('id_ad', 'IN', $id_ads);
             }
             break;
         case 1:
             $ads->where('featured', 'IS NOT', NULL)->where('featured', '>=', Date::unix2mysql())->order_by('featured', 'desc');
             break;
         case 4:
             $ads->where('featured', 'IS NOT', NULL)->where('featured', '>=', Date::unix2mysql())->order_by(DB::expr('RAND()'));
             break;
         case 0:
         default:
             $ads->order_by('published', 'desc');
             break;
     }
     //if ad have passed expiration time dont show
     if (core::config('advertisement.expire_date') > 0) {
         $ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', Date::unix2mysql());
     }
     $ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all();
     $categs = Model_Category::get_category_count();
     $locats = Model_Location::get_location_count();
     $auto_locats = NULL;
     if (core::config('general.auto_locate') and Model_User::get_userlatlng()) {
         $auto_locats = new Model_Location();
         $auto_locats = $auto_locats->select(array(DB::expr('degrees(acos(sin(radians(' . $_COOKIE['mylat'] . ')) * sin(radians(`latitude`)) + cos(radians(' . $_COOKIE['mylat'] . ')) * cos(radians(`latitude`)) * cos(radians(abs(' . $_COOKIE['mylng'] . ' - `longitude`))))) * 111.321'), 'distance'))->where('latitude', 'IS NOT', NULL)->where('longitude', 'IS NOT', NULL)->having('distance', '<=', '100')->order_by('distance', 'desc')->find_all()->as_array();
     }
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs, 'locats' => $locats, 'auto_locats' => $auto_locats));
 }
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:56,代码来源:home.php

示例15: action_delete

 public function action_delete($id = null)
 {
     if ($location = Model_Location::find($id)) {
         $location->delete();
         Session::set_flash('success', e('Deleted location #' . $id));
     } else {
         Session::set_flash('error', e('Could not delete location #' . $id));
     }
     Response::redirect('admin/locations');
 }
开发者ID:AfterCursor,项目名称:restaurant-pos-backend,代码行数:10,代码来源:locations.php


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