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


PHP Area::model方法代码示例

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


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

示例1: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'zone_id=' . $id;
     $area = new CActiveDataProvider(Area::model(), array('criteria' => $criteria));
     $this->render('view', array('model' => $this->loadModel($id), 'area' => $area));
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:11,代码来源:ZoneController.php

示例2: actionGet_route

 public function actionGet_route()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 8;
     $area = Area::model()->findAll($criteria);
     $html = '<ul class="local_trip_pro" id="local_trip_content_list" data-blockid="recommend_localjoin">';
     for ($j = 0; $j < count($area); $j++) {
         if ($j) {
             $html .= '<li class="local_trip_pro_li wq_clearfix hide" data-content="lj' . $j . '" style="display:none;">';
         } else {
             $html .= '<li class="local_trip_pro_li wq_clearfix" data-content="lj' . $j . '">';
         }
         $criteria1 = new CDbCriteria();
         $criteria1->condition = "(style & 4) !=0";
         $criteria1->addCondition('area ="' . $area[$j]->name . '"', 'AND');
         $criteria1->limit = 3;
         $route = Route::model()->findAll($criteria1);
         for ($i = 0; $i < count($route); $i++) {
             if ($i) {
                 $html .= '<a class="local_trip_right img_slide_animte_wrapper" href="';
             } else {
                 $html .= '<a class="local_trip_left_l img_slide_animte_wrapper" href="';
             }
             if ($i) {
                 $html .= '#" target="_blank"> <img class="local_trip_img_s img_slide_animte first_page"  src="' . $route[$i]->source . '" data-original="' . $route[$i]->source . '" style="display: block;"> <span class="local_trip_mask_s"></span> <span class="local_trip_txt_s" title="' . $route[$i]->name . '">' . $route[$i]->name . '</span>' . '<span class="local_trip_price_s font_size12"><span class="font_size16">' . $route[$i]->price . '</span>元/人起</span></a>';
             } else {
                 $html .= '#" target="_blank"> <img class="local_trip_img_l img_slide_animte first_page" alt=" ' . $route[$i]->name . '" src="' . $route[$i]->source . '" data-original="' . $route[$i]->source . '" style="display: block;"> <span class="local_trip_mask_l"></span> <span class="local_trip_bl"></span><span class="local_trip_txt_l" title="' . $route[$i]->name . '">' . $route[$i]->name . '</span>' . '<span class="local_trip_price_l font_size14 font_color_orange"><span class="font_size28">' . $route[$i]->price . '</span>元/人起</span></a>';
             }
         }
         $html .= '</li>';
     }
     $html .= '</ul>';
     echo $html;
 }
开发者ID:rocketyang,项目名称:yii2,代码行数:34,代码来源:HomeController.php

示例3: actionWeather

 /**
  * 根据地区woeid获取雅虎天气
  * 获取woeid http://sugg.us.search.yahoo.net/gossip-gl-location/?appid=weather&output=xml&command=地名(如香港)
  * 匹配规则:preg_match('/woeid=(\d+)\&amp;lon=.*?\&amp;lat=.*?\&amp;s=.*?\&amp;c=.*?\&amp;country_woeid/si', $_return,$match);
  * 获取天气:https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.media.weather%20where%20woeid%20in(12523356%2C90717580%2C20069923)&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=
  */
 public function actionWeather()
 {
     ini_set('memory_limit', '256M');
     ini_set('max_execution_time', '1800');
     $areas = Area::model()->findAll(array('select' => 'woeid', 'condition' => 'woeid>0 AND theorder=3'));
     $woeids = array_keys(CHtml::listData($areas, 'woeid', ''));
     $woeidsStr = join(',', $woeids);
     $dir = Yii::app()->basePath . '/runtime/weather';
     $totalDir = $dir . '/total.log';
     zmf::createUploadDir($dir);
     $start = microtime(true);
     if ($woeidsStr != '') {
         $url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.media.weather%20where%20woeid%20in({$woeidsStr})&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
         $json = zmf::curlget($url);
         file_put_contents($totalDir, $json);
     }
     $dataArr = CJSON::decode($json, true);
     $data = $dataArr['query'];
     if (!$data) {
         exit('Failed');
     }
     $results = $data['results']['result'];
     $detailDir = $dir . '/detail/';
     zmf::createUploadDir($detailDir);
     foreach ($results as $result) {
         if ($result['location']['woeid']) {
             $_dir = $detailDir . $result['location']['woeid'] . '.log';
             file_put_contents($_dir, CJSON::encode($result));
         }
     }
     echo microtime(true) - $start . '--<br/>';
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:38,代码来源:CronController.php

示例4: getList

 public static function getList()
 {
     $model = Area::model();
     $command = $model->getDbConnection()->CreateCommand();
     $tableName = $model->tableName();
     return $command->select()->from($tableName)->order('create_time DESC')->queryAll();
 }
开发者ID:WalkerDi,项目名称:mama,代码行数:7,代码来源:Area.php

示例5: loadModel

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

示例6: getPostCode

 public static function getPostCode($area)
 {
     if (is_numeric($area)) {
         return $area;
     }
     $area = Area::model()->find('name=:name', array(':name' => $area));
     if (is_null($area)) {
         return null;
     }
     return $area->postcode;
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:11,代码来源:Area.php

示例7: Dynamicdistrict

 public function Dynamicdistrict()
 {
     if ($_GET["city"]) {
         $data = Area::model()->findAll("parent_id=:parent_id", array(":parent_id" => $_GET["city"]));
         $data = CHtml::listData($data, "id", "name");
         echo CHtml::tag("option", array("value" => ''), '请选择地区', true);
         foreach ($data as $value => $name) {
             echo CHtml::tag("option", array("value" => $value), CHtml::encode($name), true);
         }
     }
 }
开发者ID:zwq,项目名称:unpei,代码行数:11,代码来源:CommonAction.php

示例8: saveProAddress

 public static function saveProAddress(UserProudctAddress $userprodaddress, $user_id)
 {
     $_POST['UserProudctAddress']['province'] = 'xx';
     $_POST['UserProudctAddress']['city'] = 'xx';
     $_POST['UserProudctAddress']['area'] = 'xx';
     $_POST['UserProudctAddress']['sysaddress'] = 'xx';
     if (isset($_POST['province'])) {
         $_POST['UserProudctAddress']['province'] = $_POST['province'];
         $provincename = Province::model()->find("provinceID=:proid", array(":proid" => $_POST['UserProudctAddress']['province']));
         if ($provincename) {
             $_POST['UserProudctAddress']['sysaddress'] = $provincename->province;
         }
     }
     if (isset($_POST['city'])) {
         $_POST['UserProudctAddress']['city'] = $_POST['city'];
         $cityname = City::model()->find("cityID=:cityid", array(":cityid" => $_POST['UserProudctAddress']['city']));
         if ($cityname) {
             $_POST['UserProudctAddress']['sysaddress'] .= $cityname->city;
         }
     }
     if (isset($_POST['area'])) {
         $_POST['UserProudctAddress']['area'] = $_POST['area'];
         $areaname = Area::model()->find("areaID=:areaid", array(":areaid" => $_POST['UserProudctAddress']['area']));
         if ($areaname) {
             $_POST['UserProudctAddress']['sysaddress'] .= $areaname->area;
         }
     }
     $_POST['UserProudctAddress']['user_id'] = $user_id;
     $userprodaddress->setAttributes($_POST['UserProudctAddress']);
     foreach ((array) $_POST['UserProudctAddress'] as $key => $value) {
         if (trim($value) == '') {
             $userprodaddress->addError($key, "字段不能为空");
             break;
         }
     }
     if (!$userprodaddress->getErrors()) {
         $userprodaddress->setAttribute('addtime', time());
         $userprodaddress->setAttribute('addip', Yii::app()->request->userHostAddress);
         if ($userprodaddress->validate()) {
             if ($userprodaddress->isNewRecord) {
                 $result = $userprodaddress->save();
             } else {
                 $result = $userprodaddress->update();
             }
             if (!$result) {
                 $userprodaddress->addError("realname", "更新失败");
             }
         } else {
             $userprodaddress->addError("realname", "更新失败");
         }
     }
     return $userprodaddress;
 }
开发者ID:bfyang5130,项目名称:zzl,代码行数:53,代码来源:MemberService.php

示例9: getarea

 public static function getarea($params)
 {
     if ($params['p'] != 0) {
         $provinceinfo = Area::model()->findByPk($params['p']);
         if ($provinceinfo) {
             $address .= $provinceinfo['Name'];
             if ($params['c'] != 0) {
                 $cityinfo = Area::model()->findByPk($params['c']);
                 if ($cityinfo) {
                     $address .= ' ' . $cityinfo['Name'];
                     if ($params['a'] != 0) {
                         $areainfo = Area::model()->findByPk($params['a']);
                         $address .= ' ' . $areainfo['Name'];
                     }
                 }
             }
         }
     } else {
         $address = '全国';
     }
     return $address;
 }
开发者ID:zwq,项目名称:unpei,代码行数:22,代码来源:LogisticsService.php

示例10: actionUpdateDistricts

 /**
  * 地区联动
  */
 public function actionUpdateDistricts()
 {
     $areastring = "area_";
     $data = Yii::app()->cache->get($areastring . (int) $_POST['idCity']);
     if (!$data) {
         $dataArea = Area::model()->findAll('father=:idCity', array(':idCity' => (int) $_POST['idCity']));
         if (!$dataArea) {
             $dataArea = City::model()->findAll('cityID=:idCity', array(':idCity' => (int) $_POST['idCity']));
             if (!$dataArea) {
                 $dataArea = Province::model()->findAll('provinceID=:idCity', array(':idCity' => (int) $_POST['idCity']));
                 $data = CHtml::listData($dataArea, 'provinceID', 'province');
             } else {
                 $data = CHtml::listData($dataArea, 'cityID', 'city');
             }
         } else {
             $data = CHtml::listData($dataArea, 'areaID', 'area');
         }
         Yii::app()->cache->set($areastring . (int) $_POST['idCity'], $data);
     }
     echo "<option value=''>选择区域</option>";
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
开发者ID:bfyang5130,项目名称:zzl,代码行数:27,代码来源:UserController.php

示例11: run

 public function run()
 {
     if ($area = Area::model()->findByAttributes(array('name' => $this->name))) {
         if ($blocks = $area->blocks) {
             if ($this->reverse) {
                 $blocks = array_reverse($blocks);
             }
             foreach ($blocks as $block) {
                 if ($block->view) {
                     $view = $block->view;
                 } else {
                     $view = $this->defaultBlockView;
                 }
                 if ($this->getViewFile($view)) {
                     $this->render($view, array('block' => $block));
                 } else {
                     echo $view . " - несуществующий вид блока!";
                 }
             }
         }
     } else {
         echo "Область вывода " . $this->name . " не найдена.";
     }
 }
开发者ID:xPashaNx,项目名称:diet,代码行数:24,代码来源:OutAreaWidget.php

示例12: actionGetcity

 public function actionGetcity()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         exit;
     }
     $city = Yii::app()->request->getParam("city");
     $criteria = new CDbCriteria();
     $criteria->select = "ID, Name";
     if (empty($city)) {
         $criteria->addCondition("t.Grade = 1");
     } else {
         $criteria->addCondition("t.ParentID = {$city}");
         $criteria->addCondition("t.Grade = 2");
     }
     $model = Area::model()->findAll($criteria);
     $data = array();
     foreach ($model as $key => $val) {
         $data[$key] = array();
         $data[$key]['ID'] = $val['ID'];
         $data[$key]['Name'] = $val['Name'];
     }
     echo json_encode($data);
     exit;
 }
开发者ID:zwq,项目名称:unpei,代码行数:24,代码来源:ServicesupportController.php

示例13: array

    <?php 
$state_data = Area::model()->findAll("grade=:grade", array(":grade" => 1));
$state = CHtml::listData($state_data, "id", "name");
$s_default = $model->isNewRecord ? '' : $model->state;
echo CHtml::dropDownList('AddressResult[state]', $s_default, $state, array('empty' => '请选择省份', 'ajax' => array('type' => 'GET', 'url' => CController::createUrl('dynamiccities'), 'update' => '#AddressResult_city', 'data' => 'js:"AddressResult_state="+jQuery(this).val()')));
//empty since it will be filled by the other dropdown
$c_default = $model->isNewRecord ? '' : $model->city;
if (!$model->isNewRecord) {
    $city_data = Area::model()->findAll("parent_id=:parent_id", array(":parent_id" => $model->state));
    $city = CHtml::listData($city_data, "id", "name");
}
$city_update = $model->isNewRecord ? array() : $city;
echo CHtml::dropDownList('AddressResult[city]', $c_default, $city_update, array('empty' => '请选择城市', 'ajax' => array('type' => 'GET', 'url' => CController::createUrl('dynamicdistrict'), 'update' => '#AddressResult_district', 'data' => 'js:"AddressResult_city="+jQuery(this).val()')));
$d_default = $model->isNewRecord ? '' : $model->district;
if (!$model->isNewRecord) {
    $district_data = Area::model()->findAll("parent_id=:parent_id", array(":parent_id" => $model->city));
    $district = CHtml::listData($district_data, "id", "name");
}
$district_update = $model->isNewRecord ? array() : $district;
echo CHtml::dropDownList('AddressResult[district]', $d_default, $district_update, array('empty' => '请选择地区'));
?>
    <?php 
echo $form->textFieldRow($model, 'zipcode', array('class' => 'span2'));
?>
</div>


<?php 
echo $form->textFieldRow($model, 'address', array('class' => 'span5'));
?>
开发者ID:jackycgq,项目名称:advanced,代码行数:30,代码来源:_form.php

示例14: model

 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:4,代码来源:ARArea.php

示例15: showDetailAddress

 public function showDetailAddress($model)
 {
     $data['receiver_country'] = $model->receiver_country;
     foreach (array('state', 'city', 'district') as $value) {
         $data['receiver_' . $value] = Area::model()->findByPk($model->{'receiver_' . $value})->name;
     }
     $data['receiver_address'] = $model->receiver_address;
     $detail_address = implode(' ', $data);
     return $detail_address;
 }
开发者ID:lhfcainiao,项目名称:basic,代码行数:10,代码来源:Order.php


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