當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。