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


PHP Place类代码示例

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


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

示例1: morePlaces

 public function morePlaces()
 {
     $places = json_decode(file_get_contents(storage_path() . '/demo-day.json'), true);
     $pages = $places['query']['pages'];
     foreach ($pages as $page) {
         $place = new Place();
         if (isset($page['coordinates'])) {
             $coords = $page['coordinates'][0];
             $place->latitude = $coords['lat'];
             $place->longitude = $coords['lon'];
         }
         if (isset($page['thumbnail'])) {
             $thumbnail = $page['thumbnail'];
             $place->img_src = $thumbnail['source'];
             $place->img_width = $thumbnail['width'];
             $place->img_height = $thumbnail['height'];
         }
         if (isset($page['extract'])) {
             $place->description = $page['extract'];
         }
         $place->title = $page['title'];
         $place->pageid = $page['pageid'];
         $place->link = "https://en.wikipedia.org/?curid={$place->pageid}";
         $place->save();
     }
 }
开发者ID:C-a-p-s-t-o-n-e,项目名称:capstone.dev,代码行数:26,代码来源:PlaceTableSeeder.php

示例2: getPlaceByCity

 public function getPlaceByCity($citiesId, $placeType)
 {
     $placeList = $this->place->join('address', 'address.place_id', '=', 'place.id');
     if (!empty($citiesId)) {
         $placeList->whereIn('address.city_id', $citiesId);
     }
     $placeList->where('place.place_type_id', '=', $placeType);
     return $placeList->get(['place.*']);
 }
开发者ID:satyapraneel,项目名称:college,代码行数:9,代码来源:PlaceRepository.php

示例3: actionCreate

 /**
  * Creates a new City model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * 
  * @return mixed
  */
 public function actionCreate($regionId)
 {
     $region = $this->findRegion($regionId);
     $model = new Place(['region_id' => $region->id]);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:heartshare,项目名称:yii2-locations,代码行数:16,代码来源:CityController.php

示例4: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl();
     $model = new Place();
     if (isset($_POST['Place'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Place'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('placeRecommend_create', array('model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:18,代码来源:PlaceRecommendController.php

示例5: actionUpdatePlace

 public function actionUpdatePlace()
 {
     $model = Place::model()->findByPk($_GET['id']);
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     if (isset($_POST['Place'])) {
         $model->attributes = $_POST['Place'];
         $model->pic_other = $imageListSerialize['dataSerialize'];
         $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(192, 470)));
         $adr = XUpload::upload($_FILES['pic_adr'], array('thumb' => true, 'thumbSize' => array(498, 364)));
         if (is_array($file)) {
             $model->pic = $file['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($adr)) {
             $model->pic_adr = $adr['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->validate() && $model->save()) {
             $this->redirect(array('/host/default/myplace'));
         }
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     } elseif ($model->pic_other) {
         $imageList = unserialize($model->pic_other);
     }
     $this->render('addplace', array('model' => $model, 'imageList' => $imageList));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:31,代码来源:DefaultController.php

示例6: showPlace

 /**
  * /
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function showPlace($id)
 {
     $result = Place::query($this->db, 'showPublished', $id);
     if ($result->isSuccessful()) {
         $this->renderArray['place'] = $result->getRecords();
     }
 }
开发者ID:pedrokoblitz,项目名称:maltz,代码行数:12,代码来源:SecultSiteDataView.php

示例7: actionUpdatePlace

 public function actionUpdatePlace()
 {
     $model = Place::model()->findByPk($_GET['id']);
     if (isset($_POST['Place'])) {
         $model->attributes = $_POST['Place'];
         $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(192, 470)));
         $adr = XUpload::upload($_FILES['pic_adr'], array('thumb' => true, 'thumbSize' => array(498, 364)));
         $other = XUpload::upload($_FILES['pic_other'], array('thumb' => true, 'thumbSize' => array(900, 600)));
         if (is_array($file)) {
             $model->pic = $file['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($adr)) {
             $model->pic_adr = $adr['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($other)) {
             $model->pic_other = $other['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->validate() && $model->save()) {
             $this->redirect(array('/host/default/myplace'));
         }
     }
     $this->render('addplace', array('model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:29,代码来源:DefaultController.php

示例8: actionView

 public function actionView($id)
 {
     $lesson = $this->loadModel($id);
     $userId = $this->_cookiesGet('userId');
     $userType = $this->_cookiesGet('userType');
     $this->_seoTitle = '课程 - ' . $lesson->name;
     //取报名人数
     $actual_students_criteria = new CDbCriteria();
     $actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id));
     $lesson->actual_students = $actual_students;
     $teacher = Teacher::model()->findByPk($lesson->teacher_id);
     $place = Place::model()->findByPk($lesson->place_id);
     //教学环境图片显示
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     //判断学员已收藏的课程
     if ($userType === 'student') {
         $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1));
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     } elseif ($place->pic_other) {
         $imageList = unserialize($place->pic_other);
     }
     $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher, 'imageList' => $imageList));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:26,代码来源:LessonController.php

示例9: GetByAssoc

 public static function GetByAssoc($values)
 {
     $item = new PlaceHotspot();
     $item->ID = $values["hotspot_ID"];
     $item->Title = $values["hotspot_Title"];
     $item->Left = $values["hotspot_Left"];
     $item->Top = $values["hotspot_Top"];
     $item->Width = $values["hotspot_Width"];
     $item->Height = $values["hotspot_Height"];
     $item->TargetPlace = Place::GetByID($values["hotspot_TargetPlaceID"]);
     $item->TargetScript = $values["hotspot_TargetScript"];
     $item->TargetURL = $values["hotspot_TargetURL"];
     switch ($values["hotspot_TargetTypeID"]) {
         case 1:
             $item->TargetType = PlaceHotspotTargetType::URL;
             break;
         case 2:
             $item->TargetType = PlaceHotspotTargetType::Script;
             break;
         case 3:
             $item->TargetType = PlaceHotspotTargetType::Place;
             break;
         default:
             $item->TargetType = PlaceHotspotTargetType::Unknown;
             break;
     }
     return $item;
 }
开发者ID:alcexhim,项目名称:PhoenixSNS,代码行数:28,代码来源:PlaceHotspot.inc.php

示例10: handleRequest

 public function handleRequest()
 {
     $arr = array('idusers' => $_SESSION['UID']);
     $content = Place::findMyPlaces($arr);
     $friend = Friend::find($arr);
     render('home', array('title' => "" . $_SESSION['UNAME'] . ' Welcome to the Places', 'content' => $content, 'friend' => $friend));
 }
开发者ID:backandy,项目名称:theplaces,代码行数:7,代码来源:home.controller.php

示例11: placeFrom

 private function placeFrom($id)
 {
     if ($cityFr = Place::where('id', '=', $id)->first()) {
         return $cityFr->full_name;
     } else {
         return null;
     }
 }
开发者ID:charlieboo,项目名称:creatrip,代码行数:8,代码来源:MethodsProfile.php

示例12: uploadImage

 public function uploadImage($placeId)
 {
     $place = Place::find($placeId);
     if (!$place) {
         return $this->errorNotFound('Place not found');
     }
     exit('This would normally upload an image somewhere but that is hard.');
 }
开发者ID:rcuvgd,项目名称:Build-API..,代码行数:8,代码来源:PlaceController.php

示例13: loadModel

 public function loadModel($id)
 {
     $model = Place::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:8,代码来源:PlaceController.php

示例14: show

 public function show($id)
 {
     $place = Place::find($id);
     if (!$place) {
         return $this->errorNotFound('Did you just invent an ID and try loading a place? Muppet.');
     }
     return $this->respondWithItem($place, new PlaceTransformer());
 }
开发者ID:rcuvgd,项目名称:Build-API..,代码行数:8,代码来源:PlaceController.php

示例15: actionIndex

 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     parent::_acl();
     $model = new Place();
     $criteria = new CDbCriteria();
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     //$criteria->with = array ( 'catalog' );
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 13;
     //$pageParams = XUtils::buildCondition( $_GET, array ( 'title' , 'catalogId','titleAlias' ) );
     //$pages->params = is_array( $pageParams ) ? $pageParams : array ();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('place_index', array('datalist' => $result, 'pagebar' => $pages));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:22,代码来源:PlaceController.php


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