I am having a table called staffusers containing usernames (user1, user2,user3) and table called customer containing usernames (customer1,customer2,customer3,…customer100).
I would like to allow certain staff users to be able to update only selective customer’s data.
I have managed to create a checkbox and dropdown list of user on the admin.php page by adding the below code in admin.php.
<?php $form=$this->beginWidget('CActiveForm'); ?> <div class="row"> <?php echo $form->labelEx($model,'Assign Data To User'); ?> <?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. ),
See the code in action http://imageshack.us/photo/my-images/29/custdata.jpg/
Can anyone please help me in getting the below things done.
In the given url http://imageshack.us/photo/my-images/29/custdata.jpg/ admin user will select some customers and then select user1 and click on submit, on submitting the selective customers will be removed from the current page and go to another page where only user1 can see those customers and not anyone else ex (user2,user3).
Similarly if selective customer’s are assigned to user2 those customer’s will get removed from the current page and seen to user2 and not anyone else. ex(user1, user3).
How can I do this? So far I haven’t found any relevant information about this. Can somebody please point me to the right direction?
Thanks a lot!