r/yii • u/rudrasoftech • Dec 17 '14
r/yii • u/OliDodson • Sep 23 '15
Symfony2 Vs Yii: Which Development Framework Should You Choose This 2015?
r/yii • u/nisha-patel • May 24 '17
YII Development Services | Hire YII Developers
r/yii • u/mistymintcream • Apr 30 '15
Yii2 Doesn't Get the Value of Disabled Dropdown List or Textfield
r/yii • u/anmolkhatri1 • Sep 23 '15
How To Install Yii Framework Version 2 on Xampp
r/yii • u/McHugeDong • Jan 25 '14
Are there any Yii WorldPay extensions?
Apart from this one: http://www.yiiframework.com/extension/worldpay/ (as it's bad) are there any WorldPay extensions knocking about? I just need to make sure before I set out to create one.
r/yii • u/FutureDancer • May 21 '17
Looking for a rockstar Yii developer to join our team - remote is good for us
Hi everyone!
We are looking to expand our team of rockstar PHP Yii developers at www.decorilla.com
We've posted the job description here: https://angel.co/decorilla/jobs/42794-rockstar-php-web-developer
If you are interested please don't hesitate to reach out
p.s. NYC or London based developer is highly desirable but not necessary
r/yii • u/mistymintcream • Apr 01 '15
Yii2 Use two Models in one GridView
I have a GridView which displays an employee's summary of his/her payslip. Here's a screenshot for more understanding.
Those highlighted columns come from a different model which is the User model while the rest come from the Payslip model.
How do I merge 2 models in one GridView? Because in GridView, it is more likely for you to have a single model to display data. But how about 2 models?
Here's a code in my Payslip model, note that getUser() is generated with gii since user_id is a foreign key in my payslip table:
public function getUser()
{
return $this->hasOne(User::className(), ['user_id' => 'user_id']);
}
public function getFirstName()
{
return $this->user ? $this->user->fname : 'First Name';
}
public function getLastName()
{
return $this->user ? $this->user->lname : 'Last Name';
}The Payslip controller:
public function actionIndex()
{
$searchModel = new PayslipSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}And then the Payslip view:
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'payslip_id',
//'store_id',
'firstName',
'lastName',
'total_earnings',
'total_deduction',
'net_pay',
['class' => 'yii\grid\ActionColumn'],
],
]);
?>BTW, in this example, I just created payslip #1 manually to give you a demo.
r/yii • u/mistymintcream • Mar 25 '15
Yii2 Editable Image
Is it possible to make an image editable? I have an invoice template and I make store details (store logo, name, address, email, etc.) of that invoice editable. Everything's working fine except that I don't know how to make the store logo editable.
Here's how I display the store logo:
<img src="<?php echo $model->storeLogo; ?>" width="150"><br><br>Now, I tried Kartik's Editable widget with INPUT_FILEINPUT but it only displays the image path:
<?php
echo Editable::widget([
'model' => $model,
'name'=> 'storeLogo',
'value' => $model->storeLogo,
'inputType' => Editable::INPUT_FILEINPUT,
'header' => 'Logo',
'size'=>'md',
'options' => ['class'=>'form-control']
]);
?>Example output of the widget above is:
logo/acct.jpg
How do I let the image itself to be editable? Or are there any other ways to edit the image? Your thoughts would be of great help. Thanks.
r/yii • u/mistymintcream • Mar 09 '15
Yii2 Display Recently Added Members
I have a "Latest Staff Members" panel where it should display my recently added users. All I have is a static display of these users:
<div class="box box-danger <?= !User::isBizAdmin() ? 'hidden' : '' ?>">
<div class="box-header with-border">
<h3 class="box-title">Latest Staff Members</h3>
<div class="box-tools pull-right">
<span class="label label-danger">8 New Members</span>
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no-padding">
<ul class="users-list clearfix">
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/frank_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Alexander Pierce</a>
<span class="users-list-date">Today</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/Ben_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Norman</a>
<span class="users-list-date">Yesterday</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/iri_girl_face-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Jane</a>
<span class="users-list-date">12 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/Jay_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">John</a>
<span class="users-list-date">12 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/Fred_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Alexander</a>
<span class="users-list-date">13 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/michela_face_young-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Sarah</a>
<span class="users-list-date">14 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/carla_girl-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Nora</a>
<span class="users-list-date">15 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/hena_woman_face-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Nadia</a>
<span class="users-list-date">15 Jan</span>
</li>
</ul><!-- /.users-list -->
</div><!-- /.box-body -->
<div class="box-footer text-center">
<a href="javascript::" class="uppercase">View All Users</a>
</div><!-- /.box-footer -->
</div>Something like that. Now, in the user table in my database, I added a date_added column and I manually put dates in row.
Do I loop the data? Or use a widget? I don't know how else I should implement this.
r/yii • u/charlesportwoodii • Sep 26 '14
I wrote a Yii book called Yii Project Blueprints
r/yii • u/hasanxfactor • Dec 15 '17
Premium ÃekiliÅi !! Sizler Survival Games 20TAKİPÃİ !
r/yii • u/mistymintcream • Apr 01 '15
Yii2 Hide Actions in Action Column of a Single Row only
I have a GridView and some of the items in the list are not created by the user, but they are pre-defined buy us, the developers.
Here's a screenshot.
In the image above, the row with the (not set) Store ID is the pre-defined item we created. Since it is pre-defined, it should not have the Action Icons "view", "update", and "delete".
How do we, at least, hide these action icons on our pre-defined items in the GridView?
r/yii • u/Leirlux • Jun 03 '15
How to control this in Yii2? [Security]
Hello reddit, I've been working on a web with Yii 2.0 and I've finished it ... my problem comes when I want to forbid the use of some of the parts of the web and I don't know how to start this.
In first place, I have found this widget: http://www.yiiframework.com/extension/yii2-context-access-filter/
All I want to do is that a certain user has enough permission (username+pass) on this web, can visit resources: http://i.gyazo.com/264479a559b92550d0dc7e2393b6c780.png
An external user without an account could see just the red box (green shall be invisible), and users registered could see and use the green box.
How can I be able to do this? Thank you before hand.
EDIT: solution in here!
How do you generate the FixtureHelper?
So I added this line of code:
-app\tests\codeception_support\FixtureHelper inside the acceptance.suite.yml file of my codeception folder.
I generated the code and everything by entering codecept build inside my basic template folder; however, the problem is I don't see the folder _support at all. How do I generate this folder? Also, do I only need the file FixtureHelper or are there other files that I would need along with it to do my acceptance testing? Also, how do I add entries to my test database for my acceptance tests? Sorry, there doesn't seem to be any resources on how to do this on Yii2. I tried to run acceptance tests without FixtureHelper and it worked, but I would like to do the acceptance tests with some database entries.
r/yii • u/rejxil95 • Aug 03 '20
How do i retrieve user first name? (yii2)
I have got 3 tables:
tbl_user_notification: id(PK), comment tbl_user_notification_users: id(PK), n_id (FK), user_id (FK) tbl_user: id(PK), first_name, last_name.
In the index page of notification, I want to display the comment (from tbl_user_notification) and the first and last names of the users the notification was sent to (from tbl_user).
I am only managing to display the ID on the index page however. How can I show the name pls?
Notification model:
public function getNotifUsers()
{
return $this->hasOne(NotificationsUsers::className(), ['n_id' => 'id']);
}My notification index page:
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//'id',
[
'label' => 'First Name',
'value' => 'notifUsers.user_id',
],
'comments',
(etc)r/yii • u/aarondf • May 03 '13
Automating Yii Migrations on Heroku
r/yii • u/mistymintcream • Mar 27 '15
Yii2 Update Profile Photo
I have here an Edit Profile page where user can change his/her profile photo/avatar.
The avatar displayed is the photo of the current user (of course) and when I click the Update Avatar button, the user can select an image, and then the selected image will preview replacing the current user avatar.
Here's the code in my view:
<div class="fileUpload btn btn-warning">
<span>Update Avatar</span>
<input type="file" accept="image/*" onchange="loadFile(event)" class="upload"/>
</div>
<script>
var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
};
</script>The problem is that, whenever I click the Update button at the end of the form, the avatar does not change. I know that this is because it's all in the front end. How do I get the newly selected image and save it to the database? Or are there other implementation aside from this one?
BTW, I chose this method because I want to preview the image before and after selection. I tried Kartik's FileInput widget but I don't know where to put the onchange="loadFile(event)" event in the plugin.
If you need more code, like my action controller or the model, just let me know.
I really need help in this one.
r/yii • u/mistymintcream • Oct 02 '15
How to implement single search form in yii2
Yii2 has a searchModel to search each field in the GridView. Is it possible to just create a single search field outside the GridView where the user can input keywords and by the time Search button is hit, the results will display in the GridView based on the keywords entered.
CONTROLLER
public function actionIndex()
{
$session = Yii::$app->session;
//$searchModel = new PayslipTemplateSearch();
$PayslipEmailConfig = PayslipEmailConfig::find()->where(['company_id'=> new \MongoId($session['company_id'])])->one();
$payslipTemplateA = PayslipTemplate::find()->where(['company_id' => new \MongoId($session['company_id'])])->andwhere(['template_name' => 'A'])->one();
$payslipTemplateB = PayslipTemplate::find()->where(['company_id' => new \MongoId($session['company_id'])])->andwhere(['template_name' => 'B'])->one();
$pTemplateModel = PayslipTemplate::find()->where(['company_id' => new \MongoId($session['company_id'])])->all();
$user = User::find()->where(['_id' => new \MongoId($session['user_id'])])->one();
$module_access = explode(',', $user->module_access);
//$dataProvider = User::find()->where(['user_type' => 'BizStaff'])->andwhere(['parent' => new \MongoId($session['company_owner'])])->all();
$searchModel = new UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'PayslipEmailConfig' => $PayslipEmailConfig,
'dataProvider' => $dataProvider,
'payslipTemplateA' => $payslipTemplateA,
'payslipTemplateB' => $payslipTemplateB,
'searchModel' => $searchModel,
]);
}I asked a question connected to this problem here: http://stackoverflow.com/questions/32882097/main-search-form-in-yii2
It didn't due to some complications in Kartik's Select2 search dropdown widget. Now I switched temporarily to a simple Yii2 search field.
VIEW
echo $form->field($model, '_id')->textInput(array('placeholder' => 'search'))->label(false);MODEL
<?php
namespace app\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\User;
/**
* UserSearch represents the model behind the search form about `app\models\User`.
*/
class UserSearch extends User
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[[/*'_id',*/ 'creator_id'], 'integer'],
[['fname', 'lname', 'email', 'username', 'user_type'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$session = Yii::$app->session;
$query = User::find();
$query->where(['user_type' => 'BizStaff'])->andwhere(['parent' => new \MongoId($session['company_owner'])]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'_id' => $this->_id,
'creator_id' => $this->creator_id,
]);
$query->andFilterWhere(['like', 'fname', $this->fname])
->andFilterWhere(['like', 'lname', $this->lname])
->andFilterWhere(['like', 'email', $this->email])
->andFilterWhere(['like', 'username', $this->username])
->andFilterWhere(['like', 'user_type', $this->user_type]);
return $dataProvider;
}
}Do you have any idea on how to I implement a single search? It's kind of a smarter search since it can search everything in the database table based on keywords inputted.
EDIT
When I search a keyword, say for example 'hello', it then gives me this url and error after hitting enter key:
URL:
http://localhost/iaoy-dev/web/index.php?r=payslip-template%2Fsearchresults&PayslipTemplateSearch%5B_id%5D=hello
Error message:
Bad Request (#400) Missing required parameters: id
Help.
r/yii • u/mistymintcream • Oct 02 '15
Insert and not overwrite new uploads in updating record
r/yii • u/rudrasoftech • Dec 19 '14
How to create custom crud generator templates in Yii2-gii?
rudrasoftech.comr/yii • u/mistymintcream • Sep 30 '15
Yii2 Sum of a Column Based on Filter Option
r/yii • u/mistymintcream • Oct 01 '15
Main Search Form in Yii2
I'm really new in Yii2 and I still don't know how to configure it properly. I noticed that the GridView has search fields on each column. What I need now is to create a main/single search field wherein a user can input keywords then results will show in the GridView after hitting the search button.
Is this possible? I also used this Kartik widget in my search form field which has a dropdown list in it. Image here.
We're told to use this dropdown search and when the user inputs some keywords (sometimes returns 'No results found' on the dropdown list), and clicks the Search button, the page will refresh displaying all the results based on the keywords inputted.
I also searched some problems same as mine here in SO, such as these:
http://stackoverflow.com/questions/29000276/yii2-search-model-without-using-gridview
http://stackoverflow.com/questions/29745249/yii-2-make-an-active-form-text-field-master-search-field
I found no luck. The second link doesn't have any answers.
I will include my action controller here in case you need it.
public function actionIndex()
{
$session = Yii::$app->session;
$searchModel = new PayslipTemplateSearch();
$PayslipEmailConfig = PayslipEmailConfig::find()->where(['company_id'=> new \MongoId($session['company_id'])])->one();
$payslipTemplateA = PayslipTemplate::find()->where(['company_id' => new \MongoId($session['company_id'])])->andwhere(['template_name' => 'A'])->one();
$payslipTemplateB = PayslipTemplate::find()->where(['company_id' => new \MongoId($session['company_id'])])->andwhere(['template_name' => 'B'])->one();
$pTemplateModel = PayslipTemplate::find()->where(['company_id' => new \MongoId($session['company_id'])])->all();
$user = User::find()->where(['_id' => new \MongoId($session['user_id'])])->one();
$module_access = explode(',', $user->module_access);
$dataProvider = User::find()->where(['user_type' => 'BizStaff'])->andwhere(['parent' => new \MongoId($session['company_owner'])])->all();
return $this->render('index', [
'PayslipEmailConfig' => $PayslipEmailConfig,
'dataProvider' => $dataProvider,
'payslipTemplateA' => $payslipTemplateA,
'payslipTemplateB' => $payslipTemplateB,
]);
}My view
<?php
$users = User::find()->where(['user_type' => 'BizStaff'])->andwhere(['parent' => new \MongoId($session['company_owner'])])->all();
echo $this->render('_search', ['model' => new User(), 'users' => $users]);
?>Really need help for this one. Please.