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


PHP Car::model方法代码示例

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


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

示例1: loadModel

 protected function loadModel($id)
 {
     $model = Car::model()->findByPk($id);
     if (empty($model)) {
         throw new CHttpException(404, 'ผิดพลาดการดึงข้อมูลรถ ลองใหม่อีกครั้ง');
     }
     return $model;
 }
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:8,代码来源:CarListController.php

示例2: afterDelete

 public function afterDelete()
 {
     # Проверка и очистка связей
     $models = Car::model()->findAll('brand_id=:brand_id', array(':brand_id' => $this->id));
     if (count($models) > 0) {
         foreach ($models as $model) {
             $model->delete();
         }
     }
     $this->deleteImage('logo_delete', $this->logo_sizes);
     return parent::afterDelete();
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:12,代码来源:Brand.php

示例3: actionIndex

 public function actionIndex()
 {
     echo "<h1>All cars</h1>";
     $cars = Car::model()->findAll();
     foreach ($cars as $car) {
         // Each car can be of class Car, SportCar or FamilyCar
         echo get_class($car) . ' ' . $car->name . "<br />";
     }
     echo "<h1>Sport cars only</h1>";
     $sportCars = SportCar::model()->findAll();
     foreach ($sportCars as $car) {
         // Each car should be SportCar
         echo get_class($car) . ' ' . $car->name . "<br />";
     }
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:15,代码来源:TestController.php

示例4: run

 public function run()
 {
     Yii::import($this->import);
     $id = Yii::app()->request->getParam('id', 0);
     if ($id <= 0) {
         echo '{}';
     } else {
         $models = Car::model()->findAll(array('condition' => 'brand_id=' . $id, 'order' => 'title'));
         $data = array('');
         foreach ($models as $m) {
             $data[$m->id] = $m->title . ' ' . EString::getYear($m->manufacture_start) . (empty($m->manufacture_end) ? '...' : ' - ' . EString::getYear($m->manufacture_end));
         }
         echo CJavaScript::jsonEncode($data);
     }
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:15,代码来源:ajaxModelsAction.php

示例5: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     if (Yii::app()->request->isAjaxRequest) {
         if ($modification = Yii::app()->request->getParam('Modification', false)) {
             $a = CHtml::listData(Car::model()->findAll('brand_id=:brand_id', array(':brand_id' => $modification['brandId'])), 'id', 'id');
             if (count($a) > 0) {
                 $criteria->compare('model_id', $a);
             } elseif ($modification['model_id'] > 0) {
                 $criteria->compare('model_id', 0);
             } else {
                 $criteria->compare('model_id', array());
             }
             $this->brandId = $modification['brandId'];
             $a = CHtml::listData(Car::model()->findAll('title like :title', array(':title' => '%' . $modification['modelTitle'] . '%')), 'id', 'id');
             if (count($a) > 0) {
                 $criteria->compare('model_id', $a);
             } elseif ($modification['modelTitle']) {
                 $criteria->compare('model_id', 0);
             } else {
                 $criteria->compare('model_id', array());
             }
             $criteria->compare('model_id', $a);
             $this->modelTitle = $modification['modelTitle'];
         }
     }
     $criteria->compare('title', $this->title, true);
     $criteria->compare('alias', $this->alias, true);
     $criteria->compare('archive', $this->archive);
     $criteria->compare('manufacture_start', $this->manufacture_start, true);
     $criteria->compare('manufacture_end', $this->manufacture_end, true);
     $criteria->compare('description', $this->description, true);
     return new CActiveDataProvider('Modification', array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->params['linesPerPage'])));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:41,代码来源:Modification.php

示例6: model

 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:4,代码来源:FamilyCar.php

示例7: saveChar

 protected function saveChar($model)
 {
     if (!($brand = Brand::model()->find('alias=:alias', array(':alias' => $model->brand_alias)))) {
         $brand = new Brand();
     }
     $brand->title = $model->brand;
     $brand->alias = $model->brand_alias;
     $brand->save();
     if (!empty($brand->errors)) {
         d('brand ' . $brand->title);
         d($brand->errors);
     }
     if (!($car = Car::model()->find('alias=:alias', array(':alias' => $model->model_alias)))) {
         $car = new Car();
     }
     $car->brand_id = $brand->id;
     $car->title = $model->model;
     $car->alias = $model->model_alias;
     $car->manufacture_start = $model->modificationManufactureStart . '0101';
     $car->manufacture_end = $model->modificationManufactureEnd ? $model->modificationManufactureEnd . '0101' : null;
     $car->save();
     if (!empty($car->errors)) {
         d('model ' . $car->title);
         d($car->errors);
     }
     if (!($mod = Modification::model()->find('alias=:alias', array(':alias' => $model->mod_alias)))) {
         $mod = new Modification();
     }
     $mod->model_id = $car->id;
     $mod->title = $model->mod;
     $mod->alias = $model->mod_alias;
     $mod->manufacture_start = $model->modificationManufactureStart . '0101';
     $mod->manufacture_end = $model->modificationManufactureEnd ? $model->modificationManufactureEnd . '0101' : null;
     $mod->save();
     if (!empty($mod->errors)) {
         d('mod ' . $mod->title);
         d($mod->errors);
     }
     if (!($char = Characteristic::model()->find('modification_id=:mod_id', array(':mod_id' => $mod->id)))) {
         $char = new Characteristic();
     }
     $char->attributes = $model->char->attributes;
     $char->modification_id = $mod->id;
     $char->save();
     if (!empty($char->errors)) {
         d('char ' . $mod->title);
         d($char->errors);
         d($model->url);
     }
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:50,代码来源:DefaultController.php

示例8: car

 public static function car($criteria = array())
 {
     return CHtml::listData(Car::model()->desc()->findAll($criteria), 'car_id', 'license_no');
 }
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:4,代码来源:Lists.php

示例9: array

<div class='row' id='<?php 
echo $this->id;
?>
'>
	<lable><?php 
echo CHtml::activeLabelEx($model, $name);
?>
</label>
	<div class='input'>
		<div id='<?php 
echo $this->id;
?>
_brand'>
			<label for='brand_id'><?php 
echo Car::model()->getAttributeLabel('brand_id');
?>
</label><br />
			<?php 
echo CHtml::dropDownList(get_class($model) . '[brand_id]', '', array());
?>
			<img src='/images/loader.gif' class='loader' style='display: none;'>
		</div>
		<?php 
if ($options['select'] != 'Brand') {
    ?>
		
		<div id='<?php 
    echo $this->id;
    ?>
_model' style='display: none;'>
			<label for='model_id'><?php 
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:31,代码来源:default.php

示例10: __construct

<?php

class Car
{
    public function __construct()
    {
        echo '12334';
    }
    public static function model()
    {
        static::getModel();
    }
    protected static function getModel()
    {
        echo "This is a car model" . PHP_EOL;
    }
}
Car::model();
class Taxi extends Car
{
    public function __construct()
    {
        parent::__construct();
        echo '12334';
    }
    protected static function getModel()
    {
        echo "This is a Taxi model2" . PHP_EOL;
    }
}
Taxi::model();
开发者ID:commiunty,项目名称:Mytest,代码行数:31,代码来源:selfVsStatic.php

示例11: loadModel

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

示例12: array

<li class="extra">
    <?php 
echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 100px;'));
?>
    <p> 
        <strong><?php 
echo '[' . $data->license_no . ']' . $data->brand->name;
?>
</strong>
        <b><a href="#show_detail_<?php 
echo $data->car_id;
?>
" rel='facebox'>Read More</a></b>
    </p>
</li>
<div id="show_detail_<?php 
echo $data->car_id;
?>
" style='display: none;'>
    <?php 
echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 600px;'));
$model = Car::model()->findByPk($data->car_id);
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('license_no', array('name' => 'date_registration', 'value' => Tools::DateTimeToShow($model->create_at, '/', false)), 'brand.name', 'engine_no', 'personnel.name', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', false)))));
?>
</div>

开发者ID:vasitjuntong,项目名称:carsnru,代码行数:25,代码来源:_list.php

示例13: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     if (Yii::app()->request->isAjaxRequest) {
         if ($model = Yii::app()->request->getParam('Characteristic', false)) {
             $a = CHtml::listData(Modification::model()->findAll('title like :title', array(':title' => '%' . $model['modificationTitle'] . '%')), 'id', 'id');
             if (count($a) > 0) {
                 $criteria->compare('modification_id', $a);
             } elseif ($modification['modificationTitle']) {
                 $criteria->compare('modification_id', 0);
             } else {
                 $criteria->compare('modification_id', array());
             }
             $criteria->compare('modification_id', $a);
             $this->modificationTitle = $model['modificationTitle'];
             $a = Car::model()->findAll('title like :title', array(':title' => '%' . $model['modelTitle'] . '%'));
             $tmp = array();
             foreach ($a as $m) {
                 if (count($m->modifications) > 0) {
                     foreach ($m->modifications as $t) {
                         $tmp[$t->id] = $t->id;
                     }
                 }
             }
             $a = $tmp;
             if (count($a) > 0) {
                 $criteria->compare('modification_id', $a);
             } elseif ($modification['modelTitle']) {
                 $criteria->compare('modification_id', 0);
             } else {
                 $criteria->compare('modification_id', array());
             }
             $criteria->compare('modification_id', $a);
             $this->modelTitle = $model['modelTitle'];
             $a = Brand::model()->findAll('title like :title', array(':title' => '%' . $model['brandTitle'] . '%'));
             $tmp = array();
             foreach ($a as $b) {
                 if (count($b->models) > 0) {
                     foreach ($b->models as $m) {
                         if (count($m->modifications) > 0) {
                             foreach ($m->modifications as $t) {
                                 $tmp[$t->id] = $t->id;
                             }
                         }
                     }
                 }
             }
             $a = $tmp;
             if (count($a) > 0) {
                 $criteria->compare('modification_id', $a);
             } elseif ($modification['brandTitle']) {
                 $criteria->compare('modification_id', 0);
             } else {
                 $criteria->compare('modification_id', array());
             }
             $criteria->compare('modification_id', $a);
             $this->brandTitle = $model['brandTitle'];
         }
     }
     $criteria->compare('fuel_capacity', $this->fuel_capacity);
     $criteria->compare('body', $this->body, true);
     $criteria->compare('doors', $this->doors);
     $criteria->compare('seats', $this->seats, true);
     $criteria->compare('weight', $this->weight);
     $criteria->compare('weight_loaded', $this->weight_loaded);
     $criteria->compare('top_speed_at', $this->top_speed_at);
     $criteria->compare('acceleration_at', $this->acceleration_at);
     $criteria->compare('top_speed_mt', $this->top_speed_mt);
     $criteria->compare('acceleration_mt', $this->acceleration_mt);
     $criteria->compare('turn_radius', $this->turn_radius);
     $criteria->compare('trunk_capacity', $this->trunk_capacity, true);
     $criteria->compare('length', $this->length);
     $criteria->compare('width', $this->width);
     $criteria->compare('height', $this->height);
     $criteria->compare('track_front', $this->tyres_front);
     $criteria->compare('track_rear', $this->tyres_front);
     $criteria->compare('track_front', $this->disks_front);
     $criteria->compare('track_rear', $this->disks_front);
     $criteria->compare('wheelbase', $this->wheelbase);
     $criteria->compare('engine_type', $this->engine_type, true);
     $criteria->compare('volume', $this->volume);
     $criteria->compare('displacement', $this->displacement, true);
     $criteria->compare('cylinders', $this->cylinders, true);
     $criteria->compare('valves', $this->valves);
     $criteria->compare('max_power', $this->max_power);
     $criteria->compare('max_power_rpm', $this->max_power_rpm, true);
     $criteria->compare('max_torque', $this->max_torque);
     $criteria->compare('max_torque_rpm', $this->max_torque_rpm, true);
     $criteria->compare('transmission_at', $this->transmission_at, true);
     $criteria->compare('gears_at', $this->gears_at, true);
     $criteria->compare('transmission_mt', $this->transmission_mt, true);
     $criteria->compare('gears_mt', $this->gears_mt, true);
     $criteria->compare('drive', $this->drive, true);
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:101,代码来源:Characteristic.php

示例14:

 <br/>โทรศัพท์ : <?php 
    echo $driver->tel;
    ?>
<br/>ตำแหน่ง : <?php 
    echo $driver->position->name;
    ?>
" 
                                 width="270px"
                                 >
                        </li>
                        <?php 
}
?>

                    <?php 
$carBuss = Car::model()->car_bus()->findAll();
foreach ($carBuss as $carBus) {
    ?>
                        <li class="item-thumbs span3 car_bus">
                            <!-- Fancybox - Gallery Enabled - Title - Full Image -->
                            <a class="hover-wrap fancybox" data-fancybox-group="gallery" title="<?php 
    echo $carBus->typeCar->name;
    ?>
" href="<?php 
    echo Yii::app()->params['pathUpload'] . $carBus->pic;
    ?>
">
                                <span class="overlay-img"></span>
                                <span class="overlay-img-thumb font-icon-plus"></span>
                            </a>
                            <!-- Thumb Image and Description -->
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:31,代码来源:_profolio_project_1.php

示例15: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Car::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:16,代码来源:ModelsController.php


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