本文整理汇总了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();
}
}
示例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.*']);
}
示例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]);
}
}
示例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));
}
示例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));
}
示例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();
}
}
示例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));
}
示例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));
}
示例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;
}
示例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));
}
示例11: placeFrom
private function placeFrom($id)
{
if ($cityFr = Place::where('id', '=', $id)->first()) {
return $cityFr->full_name;
} else {
return null;
}
}
示例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.');
}
示例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;
}
示例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());
}
示例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));
}