Ejemplo n.º 1
0
 public function actionRemoveUser($id)
 {
     $model = $this->loadModel($id);
     $pieces = explode(', ', $model->assignedTo);
     $pieces = Opportunity::editUsersInverse($pieces);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Accounts'])) {
         $temp = $model->attributes;
         $model->attributes = $_POST['Accounts'];
         $arr = $_POST['Accounts']['assignedTo'];
         foreach ($arr as $id => $user) {
             unset($pieces[$user]);
         }
         $temp = Fields::parseUsersTwo($pieces);
         $model->assignedTo = $temp;
         // $changes=$this->calculateChanges($temp,$model->attributes);
         // $model=$this->updateChangelog($model,$changes);
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('addUser', array('model' => $model, 'users' => $pieces, 'action' => 'Remove'));
 }