本文整理汇总了PHP中Manufacturer::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Manufacturer::model方法的具体用法?PHP Manufacturer::model怎么用?PHP Manufacturer::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manufacturer
的用法示例。
在下文中一共展示了Manufacturer::model方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$inn = false;
$cat = Category::model()->with('categoryDescriptions')->find('categoryDescriptions.link=:link', array(':link' => $this->current));
if (!empty($cat)) {
$catName = $cat->getName();
$categories = $cat->categories;
if (empty($categories)) {
$categories = array($cat);
$inn = true;
}
//echo print_r($categories);
} else {
$catName = 'All';
$categories = Category::model()->findAll();
}
$products = array();
$nbrands = $brands = array();
foreach ($categories as $category) {
$products = array_merge($products, $category->products);
}
foreach ($products as $product) {
$nbrands[] = $product->manufacturer_id;
}
$nbrands = array_unique($nbrands, SORT_NUMERIC);
foreach ($nbrands as $nbrand) {
$manu = Manufacturer::model()->findByPk($nbrand);
if (!empty($manu)) {
$brands[$nbrand] = $manu->name;
}
}
//$brands = asort($brands);
$this->render('category_navigation', array('inn' => $inn, 'cat' => $cat, 'name' => $catName, 'categories' => $categories, 'products' => $products, 'brands' => $brands, 'current' => $this->current));
}
示例2: loadModel
public function loadModel($id)
{
$model = Manufacturer::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例3: actionAutocomplete
public function actionAutocomplete($query)
{
$json = array();
$manufacturers = Manufacturer::model()->findAll("name LIKE '%{$query}%' ");
foreach ($manufacturers as $manufacturer) {
$json[] = array('id' => $manufacturer->manufacturer_id, 'value' => $manufacturer->name);
}
echo CJSON::encode($json);
}
示例4: save
public function save()
{
$manufacturer = Manufacturer::model()->findByPk($this->id);
if (is_null($manufacturer)) {
// is insert
$manufacturer = new Manufacturer();
}
$manufacturer->name = $this->name;
$manufacturer->image = $this->image;
$manufacturer->sort_order = $this->sortOrder;
$manufacturer->save();
// SEO Keyword
$manufacturer->updateSEOKeyword($this->seoKeyword);
// Stores
$manufacturer->clearAllStoresRelations();
if (isset($this->stores) && count($this->stores)) {
foreach ($this->stores as $storeId) {
$manufacturer->addToStore($storeId);
}
}
}
示例5: array
echo $form->labelEx($model, 'category_id');
?>
<?php
echo $form->dropDownList($model, 'category_id', CHtml::listData(Category::model()->findAll(), 'category_id', 'category_name'), array('empty' => '--please select--'));
?>
<?php
echo $form->error($model, 'category_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'manufacturer_id');
?>
<?php
echo $form->dropDownList($model, 'manufacturer_id', CHtml::listData(Manufacturer::model()->findAll(), 'manufacturer_id', 'manufacturer_name'), array('empty' => '--please select--'));
?>
<?php
echo $form->error($model, 'manufacturer_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'product_name');
?>
<?php
echo $form->textField($model, 'product_name', array('size' => 60, 'maxlength' => 64));
?>
<?php
echo $form->error($model, 'product_name');
示例6: array
?>
</div>
<div class="span3"><?php
echo $form->dropDownList($model, 'status_id', CHtml::listData(Status::model()->findAll(), 'id', 'status'), array('span' => 2, 'prompt' => '---'));
?>
<?php
echo CHtml::ajaxLink(Yii::t('status', TbHtml::button('+', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_DEFAULT))), $this->createUrl('status/addnew'), array('onclick' => '$("#divDialog2").dialog("open"); return false;', 'update' => '#divDialog2'), array('id' => uniqid()));
?>
<div id="divDialog2"></div>
</div>
<div class="span2"><?php
echo $form->labelEx($model, 'manufacturer_id', array('class' => 'inline-labels'));
?>
</div>
<div class="span3"><?php
echo $form->dropDownList($model, 'manufacturer_id', CHtml::listData(Manufacturer::model()->findAll(), 'id', 'name'), array('span' => 2, 'prompt' => '---'));
?>
<?php
echo CHtml::ajaxLink(Yii::t('manufacturer', TbHtml::button('+', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_DEFAULT))), $this->createUrl('manufacturer/addnew'), array('onclick' => '$("#divDialog4").dialog("open"); return false;', 'update' => '#divDialog4'), array('id' => uniqid()));
?>
<div id="divDialog4"></div>
</div>
</div>
</div>
</tr>
<tr>
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="span2"><?php
echo $form->labelEx($model, 'printer_type_id', array('class' => 'inline-labels'));
?>
示例7: actionManufacturer
public function actionManufacturer()
{
$criteria = new CDbCriteria();
$criteria->addCondition("t.active=1");
$criteria->addCondition("t.delete=0");
$criteria->order = "t.order, t.id DESC";
$manufacturer = null;
if (isset($_GET['manufacturer'])) {
//$criteria->addCondition("t.productCategories=".$_GET['category']);
//$categories=ProductCategories::model()->findByPk($_GET['category']);
$manufacturer = Manufacturer::model()->findByAttributes(array('non_utf8_name' => $_GET['manufacturer']));
if ($manufacturer === null || $manufacturer->active == 0 || $manufacturer->delete == 1) {
throw new CHttpException(404, 'Địa chỉ bạn yêu cầu không tồn tại.');
}
$criteria->addCondition("t.manufacturer=" . $manufacturer->id);
}
$count = Product::model()->count($criteria);
$pages = new CPagination($count);
// results per page
$pages->pageSize = Config::model()->getValueByKey('rowsperpageproduct');
$pages->applyLimit($criteria);
$models = Product::model()->findAll($criteria);
//$pageTitle = Yii::t('site', 'AllProducts');
$pageTitle = 'Tất cả sản phẩm';
$metaDescription = Config::model()->getValueByKey('metadescription');
$metaKeywords = Config::model()->getValueByKey('metakeywords');
if (isset($manufacturer)) {
$pageTitle = $manufacturer->name;
$metaDescription = $manufacturer->metadescription;
$metaKeywords = $manufacturer->metakeywords;
}
$this->pageTitle = $pageTitle . ' - ' . Config::model()->getValueByKey('sitetitle');
$this->metaDescription = $metaDescription;
$this->metaKeywords = $metaKeywords;
$this->render('products', array('products' => $models, 'categories' => $manufacturer, 'pages' => $pages));
}
示例8: getDropdown
public function getDropdown()
{
global $dataDropdown;
$dataDropdown = array();
$parents = Manufacturer::model()->with('levelTop')->findALl();
foreach ($parents as $parent) {
$dataDropdown[$parent->id] = $parent->name;
$this->_subDropDown($parent->childCategories);
}
return $dataDropdown;
}
示例9: array
<?php
$this->breadcrumbs = array('Products' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List Product', 'url' => array('index')), array('label' => 'Create Product', 'url' => array('create')));
$this->title = 'Manage Products';
?>
<!-- <h1>Manage Products</h1> -->
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'product-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('product_id', array('name' => 'category_id', 'type' => 'html', 'value' => '$data->category->category_name', 'sortable' => TRUE, 'filter' => CHtml::listData(Category::model()->findAll(), 'category_id', 'category_name')), array('name' => 'manufacturer_id', 'type' => 'html', 'value' => '$data->manufacturer->manufacturer_name', 'sortable' => TRUE, 'filter' => CHtml::listData(Manufacturer::model()->findAll(), 'manufacturer_id', 'manufacturer_name')), 'product_name', 'product_model', 'product_price', array('class' => 'CButtonColumn', 'template' => '{update} {delete}'))));
示例10: array
<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'related-form', 'enableAjaxValidation' => false));
?>
<?php
echo $form->errorSummary($model);
?>
<div class="row">
<?php
echo $form->labelEx($model, 'manufacturer_id');
?>
<?php
echo CHtml::activeDropDownList($model, 'manufacturer_id', CHtml::listData(Manufacturer::model()->findAll(), 'id', 'name'));
?>
<?php
echo $form->error($model, 'manufacturer_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'categories');
?>
<?php
echo CHtml::activeListBox($model, 'categories', CHtml::listData(Category::model()->findAll(), 'id', function ($data) {
return $data->getName();
}), array('multiple' => 'multiple'));