本文整理汇总了PHP中Vehicle::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle::model方法的具体用法?PHP Vehicle::model怎么用?PHP Vehicle::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle::model方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
$pages = new CPagination(Vehicle::model()->count($criteria));
$pages->pageSize = 8;
$pages->applyLimit($criteria);
$vehicles = Vehicle::model()->findAll($criteria);
$this->render('home', array('vehicles' => $vehicles, 'pages' => $pages));
}
示例2: actionLoadVersionVehicle
public function actionLoadVersionVehicle()
{
$criteria = new CDbCriteria();
$criteria->order = 'reference';
$criteria->condition = 'id != 32 AND id != 33 AND id != 34 AND id != 36 AND id != 37 AND id != 38 AND id != 39 AND id != 40 AND id != 41 AND id != 42';
$vehicle_version = VehicleVersion::model()->findAllByAttributes(array("vehicle_id" => $_POST['vehicle_id'], "status" => "ACTIVE"), $criteria);
$vehicle_image = Picture::model()->findByAttributes(array("vehicle_id" => $_POST['vehicle_id']));
$vehicle_s = Vehicle::model()->findByPk($_POST['vehicle_id']);
$return = array();
foreach ($vehicle_version as $z => $vehicle) {
$return[$z]['id'] = $vehicle->id;
$return[$z]['reference'] = $vehicle->reference;
$return[$z]['motor'] = $vehicle->motor;
$return[$z]['type'] = $vehicle->type;
$return[$z]['transmission'] = $vehicle->transmission;
$return[$z]['combustion'] = $vehicle->combustion;
$return[$z]['ac'] = $vehicle->ac;
$return[$z]['abs'] = $vehicle->abs;
}
$return['image'] = $vehicle_image->description;
$return['name'] = $vehicle_s->name;
echo json_encode($return);
}
示例3: actionIndex
public function actionIndex()
{
$concessioners = Concessioner::model()->findAll();
$vehicles = Vehicle::model()->findAllByAttributes(array('status' => 'ACTIVE'));
$versions = VehicleVersion::model()->findAllByAttributes(array('status' => 'ACTIVE'));
$cities = City::model()->findAll();
if (isset($_POST['Search'])) {
$criteria = new CDbCriteria();
$date = "";
$vehicle_or_version = "";
$columns = array();
switch ($_POST['Search']['module']) {
case "TechnicalDate":
$columns = array('id:number', 'client.identity:text', 'client.name:text', 'client.lastname:text', 'client.email:text', 'concessioner.name:text', 'work:text', 'preference_date:date', 'hour:text', 'taxi:text', 'detail_work:text', 'creation_date:date');
$date = "creation_date";
$vehicle_or_version = "vehicle_id";
break;
case "Quotation":
$columns = array('id:number', 'client.identity:text', 'client.name:text', 'client.lastname:text', 'client.email:text', 'concessioner.name:text', 'vehicleversion.reference:text', 'vehicleversion2.reference:text', 'time:text', 'registration_date:date');
$date = "registration_date";
$vehicle_or_version = "vehicle_version_id";
break;
case "Replacement":
$columns = array('id:number', 'client.identity:text', 'client.name:text', 'client.lastname:text', 'client.email:text', 'concessioner.name:text', 'part:text');
$vehicle_or_version = "vehicle_id";
break;
case "Suggestion":
$columns = array('id:number', 'client.identity:text', 'client.name:text', 'client.lastname:text', 'client.email:text', 'concessioner.name:text', 'vehicle.name:text', 'description:text', 'type:text', 'creation_date:date');
$date = "creation_date";
break;
}
if ($_POST['Search']['date_from'] && $_POST['Search']['date_to']) {
$criteria->addBetweenCondition('creation_date', $_POST['Search']['date_from'], $_POST['Search']['date_to']);
}
if ($_POST['Search']['city'] != 0 && $_POST['Search']['concessioner'] == 0) {
$citiess = City::model()->findByPk($_POST['Search']['city']);
foreach ($citiess->concessioners as $concessioner) {
$criteria->addSearchCondition('concessioner_id', $concessioner->id, "", 'OR');
}
} elseif ($_POST['Search']['city'] != 0 && $_POST['Search']['concessioner'] != 0) {
$criteria->addSearchCondition('concessioner_id', $_POST['Search']['concessioner']);
}
if ($_POST['Search']['identity']) {
$clients = Client::model()->findAllByAttributes(array('identity' => $_POST['Search']['identity']));
foreach ($clients as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['name']) {
$clients2 = Client::model()->findAllByAttributes(array('name' => $_POST['Search']['name']));
foreach ($clients2 as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['lastname']) {
$clients3 = Client::model()->findAllByAttributes(array('lastname' => $_POST['Search']['lastname']));
foreach ($clients3 as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['email']) {
$clients4 = Client::model()->findAllByAttributes(array('email' => $_POST['Search']['email']));
foreach ($clients4 as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['model'] != 0 && $_POST['Search']['version'] == 0) {
if ($vehicle_or_version == "vehicle_id") {
$criteria->addSearchCondition('vehicle_id', $_POST['Search']['model']);
} elseif ($vehicle_or_version == "vehicle_version_id") {
$vehicle1 = Vehicle::model()->findByPk($_POST['Search']['model']);
foreach ($vehicle1->vehicleVersions as $version) {
$criteria->addSearchCondition('vehicle_version_id', $version->id, "", 'OR');
$criteria->addSearchCondition('vehicle_version_id2', $version->id, "", 'OR');
}
}
} elseif ($_POST['Search']['model'] == 0 && $_POST['Search']['version'] != 0) {
if ($vehicle_or_version == "vehicle_version_id") {
$criteria->addSearchCondition('vehicle_version_id', $_POST['Search']['version'], "", 'OR');
$criteria->addSearchCondition('vehicle_version_id2', $_POST['Search']['version'], "", 'OR');
}
}
if ($_POST['Search']['module'] != "0") {
$pagination = new EDTPagination();
$criteria->order = "id DESC";
$pagination->applyLimit($criteria);
$sort = new EDTSort($_POST['Search']['module'], $columns);
$sort->defaultOrder = 'id';
//die(print_r($criteria));
$dataProvider = new CActiveDataProvider($_POST['Search']['module'], array('criteria' => $criteria, 'pagination' => $pagination, 'sort' => $sort));
} else {
$dataProvider = new CActiveDataProvider('TechnicalDate', array('criteria' => $criteria));
}
self::$wid = $this->createWidget('ext.EDataTables.EDataTables', array('id' => 'data_table', 'dataProvider' => $dataProvider, 'ajaxUrl' => $this->createUrl('grid/DataTables'), 'columns' => $columns, 'serverData' => array("module" => $_POST['Search']['module']), 'buttons' => array('export' => array('label' => Yii::t('app', 'Save as CSV'), 'text' => false, 'htmlClass' => '', 'icon' => Yii::app()->theme !== null && Yii::app()->theme->name == 'bootstrap' ? 'icon-download-alt' : 'ui-icon-disk', 'url' => $this->createUrl('grid/exportCVS'))), 'options' => array('bStateSave' => false, 'bPaginate' => false, 'bLengthChange' => true, 'iDisplayLength' => 50)));
if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
$this->render('index', array('cities' => $cities, 'vehicles' => $vehicles, 'versions' => $versions, 'concessioners' => $concessioners, 'widget' => self::$wid));
return;
} else {
echo json_encode($widget->getFormattedData(intval($_REQUEST['sEcho'])));
Yii::app()->end();
//.........这里部分代码省略.........
示例4: actionIndex
public function actionIndex()
{
$concessioners = Concessioner::model()->findAll();
$vehicles = Vehicle::model()->findAllByAttributes(array('status' => 'ACTIVE'));
$versions = VehicleVersion::model()->findAllByAttributes(array('status' => 'ACTIVE'));
$cities = City::model()->findAll();
if (isset($_POST['Search'])) {
$criteria = new CDbCriteria();
$date = "";
$vehicle_or_version = "";
$columns = array();
switch ($_POST['Search']['module']) {
case "TechnicalDate":
$columns = array('id', 'client.identity', 'client.name', 'client.lastname', 'client.email', 'client.phone', 'client.preference_contact', 'client.cellphone', 'client.medio', 'vehicle.model', 'vehicle.year', 'vehicle.license_plate', 'vehicle.kilometer', 'concessioner.name', 'concessioner.address', 'work', 'preference_date', 'hour', 'taxi', 'detail_work', 'creation_date');
$date = "creation_date";
$vehicle_or_version = "vehicle_id";
break;
case "Quotation":
$columns = array('id', 'Cédula' => 'client.identity:text', 'Nombre' => 'client.name:text', 'Apellido' => 'client.lastname:text', 'client.email:text', 'client.phone', 'client.preference_contact', 'client.preference_contact2', 'client.cellphone', 'client.localize', 'client.medio', 'concessioner.name', 'Ciudad' => 'concessioner.city.name', 'Vehiculo 1' => 'vehicleversion.vehicle.name', 'Referencia 1 vehículo' => 'vehicleversion.reference', 'Vehiculo 2' => 'vehicleversion2.vehicle.name', 'Referencia 2 vehículo' => 'vehicleversion2.reference', 'Tiempo' => 'time:text', 'Fecha de creación' => 'creation_date');
$date = "creation_date";
$vehicle_or_version = "vehicle_version_id";
break;
case "Replacement":
$columns = array('id:number', 'Cédula' => 'client.identity:text', 'Nombre' => 'client.name:text', 'Apellido' => 'client.lastname:text', 'client.email:text', 'client.phone', 'client.preference_contact', 'client.cellphone', 'client.medio', 'Concesionario' => 'concessioner.name:text', 'Parte a reemplazar' => 'part:text', 'vehicle.model', 'vehicle.year', 'vehicle.license_plate', 'vehicle.kilometer', 'vehicle.chasis', 'Fecha de creación' => 'creation_date');
$vehicle_or_version = "vehicle_id";
break;
case "Suggestion":
$columns = array('id:number', 'Cédula' => 'client.identity:text', 'Nombre' => 'client.name:text', 'Apellido' => 'client.lastname:text', 'client.email:text', 'client.phone', 'client.preference_contact', 'client.cellphone', 'client.medio', 'Concesionario' => 'concessioner.name:text', 'Vehículo' => 'vehicle.name:text', 'Descripción' => 'description:text', 'Tipo' => 'type:text', 'Fecha de creación' => 'creation_date:date');
$date = "creation_date";
break;
case "Satisfaction":
$columns = array('id:number', 'Cédula' => 'quotation.client.identity:text', 'Nombre' => 'quotation.client.name:text', 'Apellido' => 'quotation.client.lastname:text', 'quotation.client.email:text', 'quotation.client.phone', 'quotation.client.preference_contact', 'quotation.client.cellphone', 'client.medio', 'Concesionario' => 'quotation.concessioner.name:text', ' Cliente Contactado' => 'contact:text', 'Puntaje' => 'score:text', 'Descripción' => 'description:text', 'Fecha de creación' => 'creation_date:date');
$date = "creation_date";
break;
case "SatisfactionR":
$columns = array('id:number', 'Cédula' => 'replacement.client.identity:text', 'Nombre' => 'replacement.client.name:text', 'Apellido' => 'replacement.client.lastname:text', 'replacement.client.email:text', 'replacement.client.phone', 'replacement.client.preference_contact', 'replacement.client.cellphone', 'Concesionario' => 'replacement.concessioner.name:text', ' Cliente Contactado' => 'contact:text', 'client.medio', 'Puntaje' => 'score:text', 'Descripción' => 'description:text', 'Fecha de creación' => 'creation_date:date');
$date = "creation_date";
break;
case "SatisfactionS":
$columns = array('id:number', 'Cédula' => 'suggestion.client.identity:text', 'Nombre' => 'suggestion.client.name:text', 'Apellido' => 'suggestion.client.lastname:text', 'suggestion.client.email:text', 'suggestion.client.phone', 'suggestion.client.preference_contact', 'suggestion.client.cellphone', 'client.medio', 'Concesionario' => 'suggestion.concessioner.name:text', ' Cliente Contactado' => 'contact:text', 'Puntaje' => 'score:text', 'Descripción' => 'description:text', 'Fecha de creación' => 'creation_date:date');
$date = "creation_date";
break;
}
if ($_POST['Search']['date_from'] && $_POST['Search']['date_to']) {
$criteria->addBetweenCondition('creation_date', $_POST['Search']['date_from'], $_POST['Search']['date_to']);
}
if ($_POST['Search']['city'] != 0 && $_POST['Search']['concessioner'] == 0) {
$citiess = City::model()->findByPk($_POST['Search']['city']);
foreach ($citiess->concessioners as $concessioner) {
$criteria->addSearchCondition('concessioner_id', $concessioner->id, "", 'OR');
}
} elseif ($_POST['Search']['city'] != 0 && $_POST['Search']['concessioner'] != 0) {
$criteria->addSearchCondition('concessioner_id', $_POST['Search']['concessioner']);
}
if ($_POST['Search']['identity']) {
$clients = Client::model()->findAllByAttributes(array('identity' => $_POST['Search']['identity']));
foreach ($clients as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['name']) {
$clients2 = Client::model()->findAllByAttributes(array('name' => $_POST['Search']['name']));
foreach ($clients2 as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['lastname']) {
$clients3 = Client::model()->findAllByAttributes(array('lastname' => $_POST['Search']['lastname']));
foreach ($clients3 as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['email']) {
$clients4 = Client::model()->findAllByAttributes(array('email' => $_POST['Search']['email']));
foreach ($clients4 as $client) {
$criteria->addSearchCondition('client_id', $client->id, "", 'OR');
}
}
if ($_POST['Search']['model'] != 0 && $_POST['Search']['version'] == 0) {
if ($vehicle_or_version == "vehicle_id") {
$criteria->addSearchCondition('vehicle_id', $_POST['Search']['model']);
} elseif ($vehicle_or_version == "vehicle_version_id") {
$vehicle1 = Vehicle::model()->findByPk($_POST['Search']['model']);
foreach ($vehicle1->vehicleVersions as $version) {
$criteria->addSearchCondition('vehicle_version_id', $version->id, "", 'OR');
$criteria->addSearchCondition('vehicle_version_id2', $version->id, "", 'OR');
}
}
} elseif ($_POST['Search']['model'] == 0 && $_POST['Search']['version'] != 0) {
if ($vehicle_or_version == "vehicle_version_id") {
$criteria->addSearchCondition('vehicle_version_id', $_POST['Search']['version'], "", 'OR');
$criteria->addSearchCondition('vehicle_version_id2', $_POST['Search']['version'], "", 'OR');
}
}
if ($_POST['Search']['module'] != "0") {
$pagination = new EDTPagination();
$criteria->order = "id DESC";
$pagination->applyLimit($criteria);
$sort = new EDTSort($_POST['Search']['module'], $columns);
$sort->defaultOrder = 'id';
//.........这里部分代码省略.........
示例5: CDbCriteria
<?php
// Mini controller para un tab view
$criteria = new CDbCriteria();
$criteria->condition = 'priceType=:priceType AND price<:maxPrice';
$criteria->params = array('priceType' => Vehicle::PRICE_TYPE_TOTAL, 'maxPrice' => 3000);
$criteria->order = "t.created DESC ";
$pages = new CPagination(Vehicle::model()->count($criteria));
$pages->pageSize = 12;
$pages->pageVar = 'pageCheaps';
$pages->applyLimit($criteria);
$vehicles = Vehicle::model()->findAll($criteria);
?>
<div style="min-width:320px;">
<div style="text-align:center;">
<?php
$this->widget('CLinkPager', array('pages' => $pages, 'maxButtonCount' => 5, 'header' => '', 'prevPageLabel' => '<<', 'nextPageLabel' => '>>'));
?>
</div>
<?php
// Yii::import('application.controllers.VehicleController');
// $vehicleController = new VehicleController('vehicle'); // The id must correspond with disk structure!!!!
echo $this->renderPartial('application.views.vehicle.list', array('models' => $vehicles, 'justVehicles' => true, 'width' => 150, 'height' => 130));
?>
</div>
示例6: array
<div class="yiiForm">
<div class="simple">
<?php
echo CHtml::label(Yii::t('amo', 'Category'), '');
?>
<?php
$this->widget('ext.category.CategoryWidget', array('noSelectionText' => Yii::t('amo', 'All')));
?>
</div>
<div class="simple">
<?php
echo CHtml::label(Yii::t('amo', 'Fuel'), 'fuel');
?>
<?php
echo CHtml::dropDownList('fuel', $_REQUEST['fuel'], array_merge(array("" => Yii::t('amo', 'All')), Vehicle::model()->fuelOptions));
?>
</div>
<div class="simple">
<?php
echo CHtml::checkBox('individuals', $_REQUEST['individuals']);
?>
<?php
echo CHtml::label(Yii::t('amo', 'Just individuals'), 'individuals');
?>
</div>
<div class="simple">
<?php
echo CHtml::checkBox('professionals', $_REQUEST['professionals']);
示例7: array
echo CHtml::activeLabelEx($model, 'year');
?>
<?php
echo CHtml::activeTextField($model, 'year');
?>
<div class="hint"><?php
echo Yii::t('amo', 'Year when the vehicle was bought.');
?>
</div>
</div>
<div class="simple">
<?php
echo CHtml::activeLabelEx($model, 'color');
?>
<?php
echo CHtml::activeDropDownList($model, 'color', Vehicle::model()->colorOptions);
?>
<div class="hint"><?php
echo Yii::t('amo', 'Approximate color of the vehicle.');
?>
</div>
</div>
<div class="simple">
<?php
echo CHtml::activeLabelEx($model, 'description');
?>
<?php
$this->widget('ext.uiautogrow.EAutoGrowTextArea', array('model' => $model, 'attribute' => 'description', 'htmlOptions' => array('style' => 'width:400px')));
?>
<div class="hint"><?php
echo Yii::t('amo', 'Descripton for the vehicle. Write here everything ' . 'you consider intersting for a potential buyer.');
示例8: actionAdmin
/** Manages all models.*/
public function actionAdmin()
{
$this->processAdminCommand();
//$criteria=new CDbCriteria;
$criteria = $this->getCriteriaFromRequest();
$pages = new CPagination(Vehicle::model()->count($criteria));
$pages->pageSize = self::PAGE_SIZE;
$pages->applyLimit($criteria);
$sort = new CSort('Vehicle');
$sort->applyOrder($criteria);
$models = Vehicle::model()->findAll($criteria);
$this->render('admin', array('models' => $models, 'pages' => $pages, 'sort' => $sort));
}