• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Brand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Modelo();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Modelo'])) {
         $model->attributes = $_POST['Modelo'];
         if ($model->save()) {
             if (!empty($_POST['yt1'])) {
                 Yii::app()->user->setFlash('modelo-created', "¡El modelo <b><i>&quot;{$model->name}&quot;</i></b> fue creado exitosamente!");
                 //$this->redirect(array('create'));
                 $modelSaved = $model;
                 $model = new Modelo();
                 $model->equipment_type_id = $modelSaved->equipment_type_id;
                 $model->brand_id = $modelSaved->brand_id;
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     if (EquipmentType::model()->count('active = 1') == 0 && Brand::model()->count('active = 1') == 0) {
         throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Equipo', array('equipmentType/create')) . ' y ' . CHtml::link('crear una Marca', array('brand/create')) . '.');
     } else {
         if (EquipmentType::model()->count('active = 1') == 0) {
             throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Equipo', array('equipmentType/create')) . '.');
         } else {
             if (Brand::model()->count('active = 1') == 0) {
                 throw new CHttpException('', 'Primero debe ' . CHtml::link('crear una Marca', array('brand/create')) . '.');
             } else {
                 $this->render('create', array('model' => $model));
             }
         }
     }
 }
开发者ID:rodespsan,项目名称:LMEC,代码行数:38,代码来源:ModeloController.php


示例2: testImages

 public function testImages()
 {
     $brand = new \Brand(array('title' => 'test'));
     $brand->save();
     $brand->attachFileFromPath('avatar', __DIR__ . '/assets/flower.jpg');
     $this->assertEquals('04/4/avatar/small/' . $brand->avatar['full_name'], $brand->avatar['small']['link'], 'Small avatar works');
 }
开发者ID:solve,项目名称:database,代码行数:7,代码来源:ModelAbilityFilesTest.php


示例3: testForTest

 public function testForTest()
 {
     TranslateAbility::setLanguageId(1);
     $brand = new \Brand(array('title' => 'Apple'));
     $this->assertEquals('Apple', $brand->title, 'Accessor after creating');
     $brand->save();
     $this->assertEquals('Apple', $brand->title, 'Accessor after saving');
     $brand = \Brand::loadOne(1);
     $this->assertEquals('Apple', $brand->title, 'Accessor after loading');
     $this->assertEquals(array('id_language' => 1, 'id_object' => 1, 'title' => 'Apple'), QC::create('brands_translate')->executeOne(), 'Data stored in DB after saving');
     TranslateAbility::setLanguageId(2);
     $brand->title = 'Яблоко';
     $brand->save();
     $this->assertEquals('Яблоко', $brand->title, 'Accessor after loading');
     $this->assertEquals(array('id_language' => 2, 'id_object' => 1, 'title' => 'Яблоко'), QC::create('brands_translate')->where('id_language = :d', 2)->executeOne(), 'Data stored in DB after saving');
     $brand->loadTranslation(1);
     $this->assertEquals('Apple', $brand->title, 'loadTranslation works');
     $this->assertEquals(array('id' => 1, 'id_object' => 1, 'id_language' => 2, 'title' => 'Яблоко'), $brand->getTranslationForLanguage(2), 'getTranslationForLanguage');
     TranslateAbility::setLanguageId(1);
     $brand2 = new \Brand();
     $brand2->title = 'Samsung';
     $brand2->save();
     $brand2->loadTranslation(2);
     $this->assertEmpty($brand2->title, 'Empty data for not translated item');
     $brands = \Brand::loadList();
     $this->assertEquals(array('Apple', 'Samsung'), $brands->getFieldArray('title'), 'Loaded two translated items');
     $brands->loadTranslation(2);
     $this->assertEquals(array('Яблоко', null), $brands->getFieldArray('title'), 'Loaded two not fully translated items');
     $this->assertEquals(array(1 => array('id' => 1, 'id_object' => 1, 'id_language' => 1, 'title' => 'Apple'), 2 => array('id' => 1, 'id_object' => 1, 'id_language' => 2, 'title' => 'Яблоко')), $brand->getAllTranslations(), 'getAllTranslations()');
 }
开发者ID:solve,项目名称:database,代码行数:30,代码来源:ModelAbilityTranslateTest.php


示例4: run

 public function run()
 {
     DB::table('brands')->truncate();
     $brand = new Brand();
     $brand->name = "5TheWay";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Nike";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Adidas";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Puma";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Ripcurl";
     $brand->save();
     $brand = new Brand();
     $brand->name = "The Northface";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Overdose";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Kenstyle";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Real Tree";
     $brand->save();
     $brand = new Brand();
     $brand->name = "Game Guard";
     $brand->save();
 }
开发者ID:hungleon2112,项目名称:giaymaster,代码行数:34,代码来源:BrandTableSeeder.php


示例5: postSave

 public function postSave()
 {
     $brand = new Brand();
     $brand->client_id = Input::get('client_id');
     $brand->brand_name = Input::get('brand_name');
     $brand->category_id = Input::get('category_id');
     $brand->save();
     return Response::json($brand);
 }
开发者ID:saifurrahman,项目名称:dev,代码行数:9,代码来源:BrandController.php


示例6: insert

 public function insert(Category $category, Subcategory $subcategory, Brand $brand, Item $item)
 {
     //        $sql = "INSERT INTO item values (null, 'aalluu', 'asdfasd',true,true, '2015-10-10','asdfasf', 'asdfasd', 1, 1 ,1, 1)";
     $sql = "INSERT INTO item values (null, '" . $item->getTitle() . "','" . $item->getDetail() . "',true,false, '" . $item->getDate() . "', '" . $item->getLocation() . "','asfasf'," . $category->getId() . "," . $subcategory->getId() . ", 1 ," . $brand->getId() . ")";
     echo $sql;
     if ($this->conn->query($sql) === TRUE) {
         echo "Insert operation successful";
     } else {
         echo "Error inserting: ";
     }
 }
开发者ID:ppandey224,项目名称:manaslu,代码行数:11,代码来源:ReportService.php


示例7: executeAddBrand

 public function executeAddBrand(sfWebRequest $request)
 {
     try {
         $q = new Brand();
         $q->setBrandName($request->getParameter('brand_name'));
         $q->save();
         $this->res = "Brand Added!";
     } catch (Exception $exc) {
         $this->res = $exc->getMessage();
     }
 }
开发者ID:navid045,项目名称:maxlaptop,代码行数:11,代码来源:actions.class.php


示例8: test_delete

 function test_delete()
 {
     $name = "Nike";
     $test_brand = new Brand($name, $id);
     $test_brand->save();
     $name2 = "Adidas";
     $test_brand2 = new Brand($name2, $id);
     $test_brand2->save();
     $test_brand->delete();
     $this->assertEquals([$test_brand2], Brand::getAll());
 }
开发者ID:jeffaustin81,项目名称:shoe_store,代码行数:11,代码来源:BrandTest.php


示例9: testAddBrand

 function testAddBrand()
 {
     $store_name = "Beacons Closet";
     $new_store = new Store($store_name);
     $new_store->save();
     $brand_name = "dr.martens";
     $new_brand = new Brand($brand_name);
     $new_brand->save();
     $new_store->addBrand($new_brand);
     $result = $new_store->getBrands();
     $this->assertEquals($new_brand, $result[0]);
 }
开发者ID:jschold,项目名称:shoe_stores,代码行数:12,代码来源:StoreTest.php


示例10: testDelete

 function testDelete()
 {
     $name = "Zelds";
     $test_store = new Store($name);
     $test_store->save();
     $name = "Granite";
     $test_brand = new Brand($name);
     $test_brand->save();
     $test_brand->addStore($test_brand);
     $test_brand->delete();
     $this->assertEquals([], $test_brand->getStores());
 }
开发者ID:alexMcosta,项目名称:Shoes_Brands,代码行数:12,代码来源:BrandTest.php


示例11: testBasic

 public function testBasic()
 {
     $brand = new \Brand(array('title' => 'Apple'));
     $brand->save();
     $this->assertEquals('apple', $brand->getSlug(), 'slug ability for Apple');
     $brand->setTitle('Саша')->save();
     $this->assertEquals('sasha', $brand->getSlug(), 'slug ability for Sasha');
     $brand->setTitle('')->save();
     $this->assertEquals('n-a', $brand->getSlug(), 'slug ability for empty');
     $brand->setTitle('12 -_  s')->save();
     $this->assertEquals('12-s', $brand->getSlug(), 'slug ability for bad string');
 }
开发者ID:solve,项目名称:database,代码行数:12,代码来源:ModelAbilitySlugTest.php


示例12: __construct

 function __construct()
 {
     $this->api_config_arr = (include_once '/protected/config/Api_config.php');
     foreach ($this->api_config_arr as $config_key => $config_value) {
         unset($this->api_config_arr[$config_key]['Tmall']['brandkey']);
     }
     $brand_docking_ret = Brand::getbranddocking('*', array('status' => '=1'));
     if ($brand_docking_ret['status'] == 1) {
         foreach ($brand_docking_ret['data'] as $value) {
             $is_bool = false;
             foreach ($this->api_config_arr as $config_key => $config_value) {
                 if ($value['brandid'] == $config_value['brandid']) {
                     if (!isset($this->api_config_arr[$config_key]['Tmall'])) {
                         $this->api_config_arr[$config_key]['Tmall'] = array();
                     }
                     $this->api_config_arr[$config_key]['Tmall']['brandkey'] = $value['tamllid'];
                     $is_bool = true;
                 }
             }
             if (!$is_bool) {
                 $this->api_config_arr[] = array('brandid' => $value['brandid'], 'Tmall' => array('brandkey' => $value['tamllid']));
             }
         }
     }
 }
开发者ID:bobwuyan,项目名称:testproject,代码行数:25,代码来源:Beu_ApiConfig.php


示例13: news

 /**
  * 返回图文模板 - 多条图文,故采用方法,直接返回格式化后的字符串
  * @param String $fromUserName 发送方
  * @param String $toUserName 接收方
  * @param Array $arr 一维度数组 或 二维数组,代表一个图文消息里多个条目
  * @param Integer $brandId 品牌主键
  * 注意:
  * 数组$arr可以是关联数组,且存在键 title, description, pic_url, url
  * 也可以是索引数组,则0-3对应上述相应的值,不可错乱
  * 
  * picUrl限制图片链接的域名需要与开发者填写的基本资料中的Url一致
  */
 public static function news($fromUserName, $toUserName, $arr, $brandId)
 {
     if (ArrayUtil::depth($arr) == 1) {
         // 一维数组,图文一条条目
         if (isset($v['title'])) {
             return sprintf(PushTemplates::NEWS, $fromUserName, $toUserName, time(), $arr['title'], $arr['description'], Brand::fullPicUrl($arr['pic_url'], $brandId), URLOauth::redirect($brandId, $arr['url']));
         } else {
             return sprintf(PushTemplates::NEWS, $fromUserName, $toUserName, time(), $arr[0], $arr[1], Brand::fullPicUrl($arr[2], $brandId), URLOauth::redirect($brandId, $arr[3]));
         }
     } else {
         // 二维数组,图文多条条目
         $item = "<item>\n\t\t\t\t <Title><![CDATA[%s]]></Title> \n\t\t\t\t <Description><![CDATA[%s]]></Description>\n\t\t\t\t <PicUrl><![CDATA[%s]]></PicUrl>\n\t\t\t\t <Url><![CDATA[%s]]></Url>\n\t\t\t\t </item>";
         $itemStr = '';
         foreach ($arr as $v) {
             if (isset($v['title'])) {
                 $itemStr .= sprintf($item, $v['title'], $v['description'], Brand::fullPicUrl($v['pic_url'], $brandId), URLOauth::redirect($brandId, $v['url']));
             } else {
                 $itemStr .= sprintf($item, $v[0], $v[1], Brand::fullPicUrl($v[2], $brandId), URLOauth::redirect($brandId, $v[3]));
             }
         }
         // 注意,不能在此处 $tbl . $itemStr ."</Articles>...",然后再sprintf因此URLOauth中的网址包含了转义字符%s等,造成sprintf参数太少的错误
         $tbl = "<xml>\n\t\t\t\t\t <ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t <FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t <CreateTime>%s</CreateTime>\n\t\t\t\t\t <MsgType><![CDATA[news]]></MsgType>\n\t\t\t\t\t <ArticleCount>" . count($arr) . "</ArticleCount>\n\t\t\t\t\t <Articles>\n\t\t\t\t\t\t ";
         $frontPortion = sprintf($tbl, $fromUserName, $toUserName, time());
         return $frontPortion . $itemStr . "\n\t\t\t\t\t </Articles>\n\t\t\t\t\t <FuncFlag>1</FuncFlag>\n\t\t\t\t\t </xml>";
     }
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:38,代码来源:ResponsePush.php


示例14: actionIndex

 public function actionIndex()
 {
     $product_id = intval($_REQUEST['id']);
     $pInfo = Product::model()->getProductInfoById($product_id);
     if (empty($pInfo)) {
         $this->redirect('/?from=no_goods');
         //跳转到首页
     }
     $brandInfo = '';
     if ($pInfo['brand_id']) {
         $brandInfo = Brand::model()->findByPk($pInfo['brand_id']);
     }
     $stock = Product::model()->getProductStock($product_id, $pInfo['is_multiple']);
     $attrList = ProductAttributes::model()->getProductAttrNameList();
     $extendAttrList = ProductExtend::model()->getProductExtendAttrs($product_id);
     $is_like = Like::model()->getLikeStatus($this->user_id, $product_id);
     $cake = Category::model()->getCakeLine($pInfo['cat_id']);
     //获取商品的面包屑
     $viewData = array();
     $viewData['pInfo'] = $pInfo;
     $viewData['brandInfo'] = $brandInfo;
     $viewData['is_like'] = $is_like;
     $viewData['cake'] = $cake;
     $viewData['stock'] = $stock;
     $viewData['attrList'] = $attrList;
     $viewData['extendAttrList'] = $extendAttrList;
     $this->render('item/index', $viewData);
 }
开发者ID:conghua1013,项目名称:yii,代码行数:28,代码来源:ItemController.php


示例15: scopeBrand

 public function scopeBrand($query, $id)
 {
     $brands = Brand::lists('name', 'id');
     if ($id != "" && isset($brands[$id])) {
         $query->where('brand_id', $id);
     }
 }
开发者ID:emejiasc85,项目名称:proyecto_seminario_privado,代码行数:7,代码来源:Product.php


示例16: actionDetail

 /**
  * 品牌详情页面(带商品列表)
  */
 public function actionDetail()
 {
     $_REQUEST['id'] = intval($_REQUEST['id']);
     if (empty($_REQUEST['id'])) {
         $this->redirect('/?from=brand_empty');
     }
     $brandInfo = Brand::model()->getBrandInfoForWeb($_REQUEST['id']);
     if (empty($brandInfo)) {
         $this->redirect('/?from=brand_empty');
     }
     $result = Brand::model()->getBrandProductByPageForWeb($_REQUEST);
     if (empty($result) || $result['count'] <= 0) {
         $this->redirect('/?from=brand_product_empty');
     }
     $filter = $result['filter'];
     $urlStr = '/brand/' . $_REQUEST['id'];
     $pages = '';
     $pageShort = '';
     if ($result['count'] > 0) {
         $pages = Common::instance()->get_page_list($result['count'], $filter['p'], $filter['page_size'], $urlStr);
         $pageShort = Common::instance()->get_page_short($result['count'], $filter['p'], $filter['page_size'], $urlStr);
     }
     $viewData = array();
     $viewData['brandInfo'] = $brandInfo;
     $viewData['list'] = $result['list'];
     $viewData['count'] = $result['count'];
     $viewData['filter'] = $result['filter'];
     $viewData['pages'] = $pages;
     $viewData['pageShort'] = $pageShort;
     $this->render('brand/detail', $viewData);
 }
开发者ID:conghua1013,项目名称:yii,代码行数:34,代码来源:BrandController.php


示例17: displayMain

 public function displayMain()
 {
     global $smarty;
     $results = Brand::getEntity();
     $smarty->assign(array('brands' => $results['entitys']));
     return $smarty->fetch('brands.tpl');
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:7,代码来源:BrandsView.php


示例18: testget

 public static function testget()
 {
     return function ($request, $response) {
         $brand = Brand::findById($request->id);
         echo $brand;
     };
 }
开发者ID:samdubey,项目名称:ads2,代码行数:7,代码来源:brandctrl.php


示例19: startRecalculationAjax

 public function startRecalculationAjax()
 {
     if (Status::isCalculationInProgress()) {
         return \BootstrapUI::buttonRemoteResponse()->text('Calculation is already in progress');
     }
     return \BootstrapUI::buttonRemoteResponse()->disableButton()->text('Recalculation is in progress...')->after(function () {
         set_time_limit(0);
         \Status::calculationStarted();
         \Status::setCalculationStatus('Recalculating brands');
         \Brand::recalculate();
         \Status::setCalculationStatus('Recalculating countries');
         \Country::recalculate();
         \Status::setCalculationStatus('Recalculating packages');
         \Package::recalculate();
         \Status::setCalculationStatus('Recalculating package versions');
         \Package\Version::recalculate();
         \Status::setCalculationStatus('Recalculating phone models');
         \Phone\Model::recalculate();
         \Status::setCalculationStatus('Recalculating product names');
         \Product::recalculate();
         \Status::setCalculationStatus('Recalculating providers');
         \Provider::recalculate();
         \Status::setCalculationStatus('Recalculating stack traces');
         \Stack\Trace::recalculate();
         \Status::setCalculationStatus('Recalculating OS versions');
         \Version::recalculate();
         \Status::calculationFinished('all');
     });
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:29,代码来源:SystemController.php


示例20: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $product = Product::find($id);
     $type = ProductType::all();
     $brand = Brand::all();
     return View::make('product.edit')->withProduct($product)->withBrand($brand)->withType($type);
 }
开发者ID:abrahammontas,项目名称:Supplements-online-store,代码行数:14,代码来源:ProductsController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP BreadCrumb类代码示例发布时间:2022-05-23
下一篇:
PHP Branch类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap