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['Opportunity'])) { $temp = $model->attributes; $model->attributes = $_POST['Opportunity']; $arr = $_POST['Opportunity']['assignedTo']; foreach ($arr as $id => $user) { unset($pieces[$user]); } $temp = Opportunity::parseUsersTwo($pieces); $model->assignedTo = $temp; // $changes=$this->calculateChanges($temp,$model->attributes, $model); // $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')); }