/** * Delete and Undelete * @param $id */ public function actionDelete($id = null) { $task = YdHelper::getSubmittedField('task', 'YdRole') == 'undelete' ? 'undelete' : 'delete'; if (YdHelper::getSubmittedField('confirm', 'YdRole')) { foreach (YdHelper::getGridIds($id) as $_id) { $role = YdRole::model()->findByPk($_id); if (!$role) { continue; } call_user_func(array($role, $task)); Yii::app()->user->addFlash(strtr('Role :name has been :tasked.', array(':name' => $role->getName(), ':tasked' => $task . 'd')), 'success'); } $this->redirect(ReturnUrl::getUrl(Yii::app()->user->getState('index.role', array('/role/index')))); } $this->render('delete', array('id' => $id, 'task' => $task)); }
/** * Deletes a particular model. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id = null) { $task = YdHelper::getSubmittedField('task', 'YdAttachment') == 'undelete' ? 'undelete' : 'delete'; if (YdHelper::getSubmittedField('confirm', 'YdAttachment')) { foreach (YdHelper::getGridIds($id) as $_id) { $attachment = YdAttachment::model()->findByPk($_id); // check access if (!$attachment->checkUserAccess(Yii::app()->user->id)) { continue; } call_user_func(array($user, $task)); Yii::app()->user->addFlash(strtr('Attachment :name has been :tasked.', array(':name' => $attachment->getName(), ':tasked' => $task . 'd')), 'success'); } $this->redirect(Yii::app()->returnUrl->getUrl(Yii::app()->user->getState('index.attachment', array('/attachment/index')))); } $this->render('delete', array('id' => $id, 'task' => $task)); }