Hi All,
I am having a customer table called tbl_customer where customer information resides and staff user table called tbl_user to manage customer data.
Model customer
public function attributeLabels()
{
return array(
'name' => 'Name',
'id' => 'ID',
'username' => 'username'
'password' => 'Password',
'email' => 'Email',
'lead_assigned_to' => 'Lead Assigned To',
'package' => 'Package',
'registration_date' => 'Registration Date',
'lead_remarks' => 'Lead Remarks',
);
}
Model user
public function attributeLabels()
{
return array(
'id' => 'ID',
'username' => 'Username',
'password' => 'Password',
'email' => 'Email',
'remarks' => 'Remarks',
);
}
Every day new customer gets register and that entry gets listed in alldata.php in cgridview.
in tbl_user there is admin user also who is have access to alldata.php and for other user’s
there is a page called mydata.php which will list the customer data in cgrid view assigned to the user by admin.
in alldata.php there will be dropdown menu which will list the user’s from tbl_user and a button called Assign.
admin user will select the data with the checkbox option and then select the user to whom he wants the data to assign and click on assign button.
After clicking on Assign button the selected data will be removed from the current page (alldata.php) and then gets listed in the mydata.php page of that selected user. Similarly it applies for the remaining data also.
I have managed to create a checkbox and dropdown list user on the alldata.php page by adding the below code in alldata.php
<?php $form=$this->beginWidget('CActiveForm'); ?>
<div class="row">
<?php echo $form->labelEx($model,'lead_assigned_to'); ?>
<?php echo $form->dropDownList($model,'lead_assigned_to', CHtml::listData(User::model()->findAll(), 'username', 'username'), array('empty'=>'Please Select'));?>
<?php echo $form->error($model,'lead_assigned_to'); ?>
</div>
......
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'customer-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'selectableRows'=>2 //allows to check multiple rows.
),
Can anyone please help me in getting the below things done.
admin user will select the data with the checkbox option and then select the user to whom he wants the data to assign and click on assign button.
After clicking on Assign button the selected data will be removed from the current page (alldata.php) and then gets listed in the mydata.php page of that user. Similarly it applies for the remaining data also.
Thanks in advance