當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Brand類代碼示例

本文整理匯總了PHP中Brand的典型用法代碼示例。如果您正苦於以下問題:PHP Brand類的具體用法?PHP Brand怎麽用?PHP Brand使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Brand類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Brand類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。