yii-extensions

Yii2: Using Kartik Depdrop Widget?

梦想与她 提交于 2019-12-02 03:12:18
Ok I am trying to use the Kartik Depdrop widget, all I am getting a white drop-down list that is values not showing in the dependent drop-down list. I have a state model and a city model and I have it setup like this. In _form.php $catList=ArrayHelper::map(app\models\State::find()->all(), 'id', 'state_name' ); echo $form->field($model, 'state')->dropDownList($catList, ['id'=>'state_name']); echo $form->field($model, 'district_city')->widget(DepDrop::classname(), [ 'options'=>['id'=>'district_city'], 'pluginOptions'=>[ 'depends'=>['state_name'], // the id for cat attribute 'placeholder'=>

Credit card transactions in Yii [closed]

天涯浪子 提交于 2019-12-02 02:03:14
How can we implement credit card transactions in Yii? Your question is not that detailed of what you have tried or you are asking about API or something. What i can say is Stripe has a PHP library to accept credit cards without needing a merchant account. If you need something quick and dirty , you can just use PayPal's "Buy" buttons and drop them on your pages. These will take people off-site to PayPal where they can pay with a PayPal account or a credit card. This is free and super easy to implement. If you want something a bit nicer where people pay on-site with their credit card, then you

Yii Set Default Sort Order in Model

 ̄綄美尐妖づ 提交于 2019-12-01 23:54:15
问题 I create a web app with Yii with the yii-user extension. At user listing page, display the user list was ordered by create_at. I want to display the user list order by username. This is original code: public function search() { $criteria=new CDbCriteria; $criteria->compare('id',$this->id); $criteria->compare('username',$this->username,true); $criteria->compare('password',$this->password); $criteria->compare('email',$this->email,true); $criteria->compare('activkey',$this->activkey); $criteria-

Yii2: Replace default confirmation message used by Gridview with Sweet alert

♀尐吖头ヾ 提交于 2019-12-01 20:37:27
I am using yii2mod/yii2-sweet-alert in my projects, I am using it on basic and advanced themes, and I love it. The question. How can I change the grid default confirmation dialog that is a plain javascript confirmation in order to use Sweet-alert to make it look better? I already tried modifying the button's template for the delete, because if you want to change the message you will do the following: [ 'class' => ActionColumn::className(), 'template' => '{update}{delete}', 'buttons' => [ 'delete' => function($url, $model){ return Html::a('<span class="glyphicon glyphicon-trash"></span>', [

Yiistrap configuration issue

扶醉桌前 提交于 2019-12-01 11:53:13
I am trying to get Yiistrap (Bootstrap for the Yii Framework) to work on Cent OS 6.5. I've unpacked the yiistrap-master into extensions/bootstrap and added the following to protected/config/main.php: // uncomment the following to define a path alias // Yii::setPathOfAlias('local','path/to/local-folder'); // CWebApplication properties can be configured here. return array( 'aliases'=>array( 'bootstrap'=>'/var/www/html/happytails/protected/extensions/bootstrap' ), 'import'=>array ( 'bootstrap.helpers.TbHtml', 'components'=>array( 'bootstrap'=>array( 'class'=>'bootstrap.components.TbApi' ), I also

Yii2: Using Kartik Depdrop Widget?

可紊 提交于 2019-12-01 08:09:23
问题 Ok I am trying to use the Kartik Depdrop widget, all I am getting a white drop-down list that is values not showing in the dependent drop-down list. I have a state model and a city model and I have it setup like this. In _form.php $catList=ArrayHelper::map(app\models\State::find()->all(), 'id', 'state_name' ); echo $form->field($model, 'state')->dropDownList($catList, ['id'=>'state_name']); echo $form->field($model, 'district_city')->widget(DepDrop::classname(), [ 'options'=>['id'=>'district

Yii how to get clean and pretty URL

蓝咒 提交于 2019-11-30 18:00:58
问题 I am newbie to Yii framework. I have uncommented the url manager in the config file and got a url scheme like this: http://localhost/mysite/index.php/displayAll I don't want the index.php in the url. So I want a url some thing like this http://localhost/mysite/displayAll To accomplish this, what should I do. I did play with the url manager and some htaccess, but nothing gone well. Please help 回答1: Try: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

Yii2 role management with rbac and database storage

▼魔方 西西 提交于 2019-11-30 01:32:31
I want to learn Yii2 membership and use Yii to store and retrieve roles using a database. I have read Security Authorization and How to add role to user? and Does Anyone Have A Working Example Of Rbac? and also try using the yii2-admin extension and tried to understand how Yii manages user roles but I can't find any working samples or simple step by step examples. Please guide me and tell me the simplest solution. Implementing a role based access control is a very easy process and you can even load your roles from the database if you want. Step1: Creating necessary tables in the database [ You

How to validate email and email already exist or not check, in Yii Framework?

和自甴很熟 提交于 2019-11-29 09:14:51
How to validate email using Yii Model validation rules function code. Also how to check email exist or not using Model validation rules function in Yii. You can set your model validations as below public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( //First parameter is your field name of table which has email value array('email', 'email','message'=>"The email isn't correct"), array('email', 'unique','message'=>'Email already exists!'), ); } Yii Reference Link For More Detail: http://www.yiiframework.com/wiki/56/

Yii2 role management with rbac and database storage

北战南征 提交于 2019-11-28 21:41:54
问题 I want to learn Yii2 membership and use Yii to store and retrieve roles using a database. I have read Security Authorization and How to add role to user? and Does Anyone Have A Working Example Of Rbac? and also try using the yii2-admin extension and tried to understand how Yii manages user roles but I can't find any working samples or simple step by step examples. Please guide me and tell me the simplest solution. 回答1: Implementing a role based access control is a very easy process and you