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