public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['author_list' => ['authors', 'get' => function ($value) {
         return JSON::encode($value);
     }, 'set' => function ($value) {
         return JSON::decode($value);
     }], 'review_list' => ['reviews', 'get' => function ($value) {
         return JSON::encode($value);
     }, 'set' => function ($value) {
         return JSON::decode($value);
     }]]]];
 }
Пример #2
0
 /**
  * Creates a new Invoice model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Invoice();
     if ($model->load(Yii::$app->request->post())) {
         //get Customer information
         $customer = Customer::find()->where(['id' => 1])->asArray()->one();
         /*          echo '<pre>';
                     print_r(JSON::encode($customer));
                     echo '</pre>';*/
         $model->attribute1 = JSON::encode($customer);
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #3
0
 /**
  * Get customer Bank Account form attribute col with JSON Format
  */
 public function getCustomerBankAccount()
 {
     $attributeCustomer = JSON::decode($this->attribute1);
     return isset($attributeCustomer['bank_account']) ? $attributeCustomer['bank_account'] : '';
 }
Пример #4
0
 private function _file($url, $params = array())
 {
     $updatesrv = Yii::$app->params['updatesrv'];
     $output = Yii::$app->curl->setOptions(array('Content-Type: application/xml', CURLOPT_CAINFO => Yii::$app->basePath . '/data/rootCA.pem'))->post($updatesrv . $url, \yii\helpers\JSON::encode($params));
     return $output;
 }
Пример #5
0
<?php

use yii\helpers\Html;
$catalog = (require __DIR__ . '/catalog.php');
return ['languages' => ['ru' => 'russian'], 'Api' => ['tovar_tip' => ['tip_id', "category_id", "name", "store_id", "price", "count", "ball", "description", 'image']], 'Parts' => ['sort' => ['attributes' => ['name', 'price']], 'pagination' => ['pageSize' => 25], 'columns' => ['sklad', ['attribute' => 'code', 'label' => 'Артикул'], ['attribute' => 'name', 'label' => 'Название', 'format' => 'html', 'value' => function ($model, $index, $widget) {
    return $model['code'] . ' ' . $model['name'] . ' ' . $model['manufacture'];
}], ['attribute' => 'price', 'label' => 'Цена'], ['attribute' => 'srokdays', 'label' => 'srokdays'], ['attribute' => 'quantity', 'label' => 'Количество'], ['attribute' => 'srok', 'label' => 'Доставка', 'options' => ['class' => 'col-xs-2']], ['attribute' => 'provider', 'label' => 'Провайдер'], ['attribute' => 'flagpostav', 'label' => 'Поставщик'], ['attribute' => 'estimation', 'label' => 'Надежность'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{basket}', 'buttons' => ['basket' => function ($url, $model, $key) {
    return Html::a('<i class="icon-shopping-cart icon-white "></i>Заказать', '#', ['title' => 'Заказать', 'class' => 'btn btn-primary btn-xs orderbud' . $key . '', 'onClick' => '$.ajax({ type :"POST", "data" : ' . \yii\helpers\JSON::encode($model) . ', url : "' . \yii\helpers\Url::to(['tovar/basket']) . '", success : function(d) { $(".orderBud' . $key . '").parent().html(d) } });return false;']);
}]]], 'PartsProvider' => ['Kd' => ['class' => 'app\\modules\\autoparts\\providers\\Kd', 'fields' => ['code' => 'detailnumber', "name" => "detailname", "manufacture" => "maker_name", "srokmin" => "srokmin", "srokmax" => "srokmax", "sklad" => "storeid"], 'marga' => 1, 'id' => 5, 'name' => 'Колеса даром', 'methods' => ['FindDetails' => 'FindDetails']], 'Over' => ['class' => 'app\\modules\\autoparts\\providers\\Over', 'internal_day' => 4, 'fields' => ['code' => 'code', 'name' => 'name', 'manufacture' => 'manufacture', 'price' => 'price', 'quantity' => 'quantity', 'srokmin' => 'srokmin', 'srokmax' => 'srokmax', 'estimation' => '0', 'lotquantity' => 'lotquantity', 'pricedate' => 'pricedate', 'skladid' => 'skladid', 'sklad' => 'sklad', 'flagpostav' => 'flagpostav', 'storeid' => 'storeid'], 'marga' => 1, 'id' => 7, 'name' => 'Over', 'methods' => ['FindDetails' => 'FindDetails']], 'Avtostels' => ['class' => 'app\\modules\\autoparts\\providers\\Avtostels', '_wsdl_uri' => 'https://allautoparts.ru/WEBService/SearchService.svc/wsdl?wsdl', 'fields' => ["code" => "AnalogueCodeAsIs", "name" => "ProductName", "manufacture" => "AnalogueManufacturerName", "price" => "Price", "quantity" => "Quantity", "srokmin" => "PeriodMin", "srokmax" => "PeriodMax"], 'marga' => 1.15, 'id' => 3, 'name' => 'Автостелс', 'methods' => ['FindDetails' => 'SearchOffer3'], 'options' => ['soap_version' => SOAP_1_1]], 'Iksora' => ['class' => 'app\\modules\\autoparts\\providers\\Iksora', '_wsdl_uri' => 'http://ws.auto-iksora.ru:83/searchdetails/searchdetails.asmx?WSDL', 'fields' => ["code" => "detailnumber", "name" => "detailname", "manufacture" => "maker_name", "srokmin" => "days", "srokmax" => "dayswarranty", "sklad" => "regionname"], 'marga' => 1.15, 'id' => 1, 'name' => 'Иксора', 'methods' => ['FindDetails' => 'FindDetailsStockXML'], 'options' => ['soap_version' => SOAP_1_1]], 'Emex' => ['class' => 'app\\modules\\autoparts\\providers\\Emex', '_wsdl_uri' => 'http://ws.emex.ru/EmExService.asmx?WSDL', 'toBasket_wsdl_uri' => 'http://ws.emex.ru/EmEx_Basket.asmx?WSDL', 'fields' => ["code" => "DetailNum", "name" => "DetailNameRus", "manufacture" => "MakeName", "srokmin" => "ADDays", "srokmax" => "DeliverTimeGuaranteed", "price" => "ResultPrice", "lotquantity" => "LotQuantity", "quantity" => "Quantity", "skladid" => "PriceLogo", "sklad" => "PriceCountry", "groupid" => "PriceGroup", "estimation" => "DDPercent"], 'marga' => 1.15, 'id' => 4, 'name' => 'Emex', 'methods' => ['FindDetails' => 'FindDetailAdv3', 'toBasket' => 'InsertToBasket2']], 'Partkom' => ['class' => 'app\\modules\\autoparts\\providers\\Partkom', '_wsdl_uri' => 'http://www.part-kom.ru/webservice/search.php?wsdl', 'fields' => ["code" => "number", "name" => "description", "manufacture" => "maker", "srokmin" => "minDeliveryDays", "srokmax" => "maxDeliveryDays", "lotquantity" => "minQuantity", "pricedate" => "lastUpdateDate", "pricedestination" => "PriceDestination", "statSuccessCount" => "statSuccessCount", "statRefusalCount" => "statRefusalCount", "statTotalOrderCount" => "statTotalOrderCount", "skladid" => "providerId", "sklad" => "providerDescription", "groupid" => "detailGroup"], 'marga' => 1.15, 'id' => 2, 'name' => 'Партком', 'methods' => ['FindDetails' => 'findDetail']]]], 'securitykey' => 'k', 'nouser_id' => 7, 'adminEmail' => '*****@*****.**', 'catalog' => $catalog, 'host' => 'http://img2.kolesa-darom.ru/img/', 'image' => ['disk' => ['normal' => 'disk/', 'big' => 'disk/big/', 'name' => 'category_id'], 'zapchasti_VAZ' => ['normal' => 'zapchastivaz/', 'big' => 'zapchastivaz/big/', 'name' => 'category_id'], 'shina' => ['normal' => 'tyres/', 'big' => 'tyres/big/', 'name' => 'category_id'], 'bagachniki' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'quadroshina' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'category_id'], 'kovriki' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'agriculturalshina' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'category_id'], 'autokameri' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'category_id'], 'industrialshina' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'category_id'], 'velopokryshki' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'category_id'], 'vstavka' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'id'], 'zashity' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'autosignalizacii' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'shetki' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'kompressor' => ['normal' => 'radar/', 'big' => 'radar/big/', 'name' => 'category_id'], 'nabor' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'vetroviki' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'ustkolza' => ['normal' => 'video/', 'big' => 'video/big/', 'name' => 'category_id'], 'boatoil' => ['normal' => 'gruz/', 'big' => 'gruz/big/', 'name' => 'id'], 'motomotormasla' => ['normal' => 'motomasla/', 'big' => 'motomasla/big/', 'name' => 'category_id'], 'avtomotormasla' => ['normal' => 'motomasla/', 'big' => 'motomasla/big/', 'name' => 'category_id'], 'gruzmotormasla' => ['normal' => 'motomasla/', 'big' => 'motomasla/big/', 'name' => 'category_id']], 'navbar' => ['all' => [['label' => 'Корзина', 'url' => ['/basket/basket']], ['label' => 'Информация', 'items' => [['label' => 'Главная страница', 'url' => ['/site/index']], ['label' => 'О компании', 'url' => ['/site/about']], ['label' => 'Обратная связь', 'url' => ['contact']], ['label' => 'Партнеры', 'url' => ['partner']]]]], 'quest' => [['label' => 'Личный кабинет', 'items' => [['label' => 'Регистрация', 'url' => ['/user/registration/register']], ['label' => 'Вход', 'url' => ['/user/security/login']]]]], 'user' => [['label' => 'Личный кабинет', 'items' => [['label' => 'Заказы', 'url' => ['/user/settings/orders']], ['label' => 'Выход', 'url' => ['/user/security/logout'], 'linkOptions' => ['data-method' => 'post']]]]]]];
Пример #6
-13
<?php 
kartik\form\ActiveForm::end();
$this->registerJs("\$('#mailtemplate-entity_type').change(function(){\r\n        change();\r\n    });", \yii\web\View::POS_READY);
?>
<script type="text/javascript">
    
    
    
    
function change(){
    var accList=<?php 
echo \yii\helpers\JSON::encode(\yii\helpers\ArrayHelper::map(Acctype::find()->All(), 'id', 'name'));
?>
;
    var docList=<?php 
echo \yii\helpers\JSON::encode(\yii\helpers\ArrayHelper::map(Doctype::find()->All(), 'id', 'name'));
?>
;
    //console.log(docList.length);
    if($("#mailtemplate-entity_type").val()=='app\\models\\Accounts'){
        loadList(accList);
    }else{
        loadList(docList);   
    }
        
}    

function loadList(list){
    
    $("#mailtemplate-entity_id")
            .find('option')
Пример #7
-23
 protected function registerPlugin()
 {
     $view = $this->getView();
     if (isset($this->selector)) {
         $id = $this->selector;
     } else {
         $id = '#' . $this->options['id'];
     }
     $this->config = ArrayHelper::merge(['selector' => $id], $this->config);
     $options = JSON::encode($this->config);
     TinyMCEAsset::register($view);
     if ($this->toggle['active']) {
         $toggle = $this->toggle['id'];
         $start = '';
         if ($this->toggle['tinyStart']) {
             $start = 'toggleTiny' . $toggle . '();';
         }
         $view->registerJs("toggleTiny{$toggle}=function(){tinymce.init({$options});};\nunToggleTiny{$toggle}=function(){tinymce.remove('{$id}')};\n{$start}");
     } elseif (isset($this->functionName)) {
         $view->registerJs("{$this->functionName}=function(){tinymce.init({$options})}");
     } else {
         $view->registerJs("tinymce.init({$options})");
     }
 }