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


PHP Place::model方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: actionView

 public function actionView($id)
 {
     // require a place id as param
     // retrieve a place from db using the id
     $places = Place::model()->findAllByAttributes(array('id' => $id));
     // organise place object into an array
     $rows = array();
     foreach ($places as $place) {
         $rows[] = array('id' => $place->id, 'type' => $place->type, 'name' => $place->name, 'detail' => $place->detail, 'pic' => $place->pic, 'comments' => $this->getComments($place->id));
     }
     // render view a place page with a place info
     $this->render('view', array('places' => $places));
 }
开发者ID:phongsathon-jk,项目名称:wil_webapp,代码行数:13,代码来源:SiteController.php

示例6: 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);
     //判断学员已收藏的课程
     if ($userType === 'student') {
         $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1));
     }
     $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:18,代码来源:LessonController.php

示例7: actionListName

 public function actionListName($type, $term)
 {
     $term = addcslashes($term, '%_');
     $criteria = new CDbCriteria();
     if (strlen($type) == 0) {
         // if not select a type, create criteria with only name LIKE
         $criteria->condition = "name LIKE :term";
         $criteria->params = array(':term' => "%{$term}%");
     } else {
         // if select a type, create criteria with name LIK and the selected type
         $criteria->condition = "name LIKE :term AND type=:type";
         $criteria->params = array(':term' => "%{$term}%", ':type' => $type);
     }
     // get only 'name' from table
     $criteria->select = "name";
     $places = Place::model()->findAll($criteria);
     $names = array();
     foreach ($places as $place) {
         $names[] = $place->name;
     }
     echo json_encode($names);
 }
开发者ID:phongsathon-jk,项目名称:wil_webapp,代码行数:22,代码来源:ApiController.php

示例8: actionIndex

 public function actionIndex()
 {
     $this->_seoTitle = '中国传统文化教育|东方美学|中式精致生活|我要去上课';
     $placeCriteria = new CDbCriteria();
     $teacherCriteria = new CDbCriteria();
     $picCriteria = new CDbCriteria();
     $placeCriteria->limit = '3';
     $placeCriteria->order = 'id DESC';
     $placeCriteria->addCondition('status = :status');
     $placeCriteria->params[':status'] = 1;
     $teacherCriteria->limit = '8';
     $teacherCriteria->order = 'id DESC';
     $teacherCriteria->addCondition('status = :status');
     $teacherCriteria->params[':status'] = 1;
     $picCriteria->limit = '4';
     $picCriteria->order = 'id DESC';
     $picCriteria->addCondition('check_status = :check_status');
     $picCriteria->params[':check_status'] = 1;
     $lesson = Lesson::model()->findByAttributes(array('id' => '5'));
     $place = Place::model()->findAll($placeCriteria);
     $teacher = Teacher::model()->findAll($teacherCriteria);
     $pic = Lesson::model()->findAll($picCriteria);
     $this->render('index', array('place' => $place, 'teacher' => $teacher, 'lesson' => $lesson, 'pic' => $pic));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:24,代码来源:SiteController.php

示例9: beforeDelete

 protected function beforeDelete()
 {
     //delete images for these records if uploaded
     $placeInfo = Place::model()->find('createdByUserId=' . Yii::app()->user->getId() . ' AND title is NULL');
     if (count($placeInfo) > 0) {
         $fileInfos = File::model()->findAll("recordId=" . $placeInfo->id . " AND recordType='Place'");
         if (count($fileInfos) > 0) {
             foreach ($fileInfos as $fileInfo) {
                 $dirPath = $fileInfo->fullPath . '/';
                 if (GalleryImage::model()->findByPk($fileInfo->id)->delete()) {
                     if (@rmdir($dirPath)) {
                         return true;
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:19,代码来源:Place.php

示例10: actionReview

 public function actionReview()
 {
     $message = false;
     $place = Place::model()->findByPk($_GET['id']);
     $host = Host::model()->findByPk($place['host_id']);
     $model = PlaceReview::model()->findByAttributes(array('place_id' => $_GET['id'], 'teacher_id' => $this->_user['masterId']));
     if (!count($model)) {
         $model = new PlaceReview();
     }
     if (isset($_POST['PlaceReview'])) {
         $model->attributes = $_POST['PlaceReview'];
         $model->place_id = $_GET['id'];
         $model->teacher_id = $this->_user['masterId'];
         if ($model->save()) {
             $message = true;
         }
     }
     $this->render('review', array('place' => $place, 'host' => $host, 'message' => $message, 'model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:19,代码来源:DefaultController.php

示例11: run

 public function run()
 {
     $criteria = new CDbCriteria();
     $list = Place::model()->findAll($criteria);
     $this->render('place', array('list' => $list));
 }
开发者ID:hongha,项目名称:traodoidocu,代码行数:6,代码来源:wPlace.php

示例12: array

	<script type="text/javascript">CKEDITOR.replace( 'editor'); </script>
	<div class="margin-left-15">
		<p>Từ khóa về sản phẩm</p>
		<?php 
$this->widget('CAutoComplete', array('model' => $model, 'attribute' => 'tags', 'url' => array('suggestTags'), 'multiple' => true, 'htmlOptions' => array('size' => 50)));
?>
		<p class="hint">Bạn có thể chọn nhiều từ khóa cho sản phẩm.</p>
		<?php 
echo $form->error($model, 'tags');
?>
	</div>

	<div class="margin-left-15">
		<p>Khu vực</p>
		<?php 
echo $form->dropDownList($model, 'status', CHtml::listData(Place::model()->findAll(), 'id', 'name'), array('class' => 'btn btn-default'));
?>
		<?php 
echo $form->error($model, 'status');
?>
	</div>
	

	<div class="margin-left-15">
		<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Tạo bài đăng' : 'Lưu', array('class' => 'btn btn-default'));
?>
	</div>

<?php 
$this->endWidget();
开发者ID:hongha,项目名称:traodoidocu,代码行数:31,代码来源:_form.php

示例13: actionShowMap

 /**
  * @param        $id
  * @param string $mode
  * @throws CHttpException
  */
 public function actionShowMap($id, $mode = 'map')
 {
     $this->layout = '//layouts/popup-iframe';
     $park = $this->loadModel($id);
     if (!$park->location->latitude || !$park->location->longitude) {
         throw new CHttpException(404, 'Park  map not defined');
     }
     $parks = Place::model()->findAll(['scopes' => 'onlyActive']);
     $this->render("//MapView/default", array('id' => $id, 'latitude' => $park->location->latitude, 'longitude' => $park->location->longitude, 'type' => 'park', 'mode' => $mode, 'mapDim' => ['w' => '80%', 'h' => ''], 'parks' => $parks, 'nearestTransport' => true));
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:15,代码来源:ParkController.php

示例14: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate()
 {
     if (isset($_GET['errorLocate'])) {
         Yii::app()->user->setFlash('warning', 'Sorry, we couldn\'t set up your location automatically. Please enter it manually below:');
     }
     // Login required
     if (null !== Yii::app()->user) {
         $user_id = Yii::app()->user->id;
     } else {
         $this->redirect(Yii::app()->getModule('user')->loginUrl);
     }
     // create a default location if no entry exists
     UserLocation::model()->createDefault($user_id);
     $model = $this->loadModelByUser($user_id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['UserLocation'])) {
         $model->attributes = $_POST['UserLocation'];
         // lookup gps coordinate from address
         $location_results = $model->lookupGeoLatLon($model['address'], $model['city'], $model['state_id'], $model['country_id']);
         $model->gps = new CDbExpression("geomfromtext('" . $location_results['gps'] . "')");
         // lookup neighborhood
         $model->neighborhood_id = Neighborhoods::model()->lookupFromLatLon($location_results['gps']);
         // new: add user to neighborhood when they set location
         $neighborhood_place = Place::model()->find(array('condition' => 'neighborhood_id=:neighborhood_id', 'params' => array(':neighborhood_id' => $model->neighborhood_id)));
         if ($neighborhood_place !== null) {
             Place::model()->join($user_id, $neighborhood_place['id']);
             // use place->id
         }
         if ($model->save()) {
             UserLocation::model()->setLocationFlag($user_id);
             Yii::app()->user->setFlash('location_saved', 'Your location settings have been saved. Now you can join or create places near you.');
             $this->redirect(Yii::app()->baseUrl . '/place/near');
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:mafiu,项目名称:listapp,代码行数:42,代码来源:UserlocationController.php

示例15: addMember

 private function addMember($email, $slug)
 {
     $u = User::model()->find(array('select' => 'id', 'condition' => 'email=:email', 'params' => array(':email' => $email)));
     $p = Place::model()->find(array('select' => 'id', 'condition' => 'slug=:slug', 'params' => array(':slug' => $slug)));
     $x = Place::model()->join($u->id, $p->id);
 }
开发者ID:mafiu,项目名称:listapp,代码行数:6,代码来源:TestController.php


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