AnaestheticAgentDefaultsController::actionDelete PHP Method

actionDelete() public method

public actionDelete ( $itemId )
    public function actionDelete($itemId)
    {
        /*
         * We make sure to not allow deleting directly with the URL, user must come from the commondrugs list page
         */
        if (!Yii::app()->request->isAjaxRequest) {
            $this->render('errorpage', array('errorMessage' => 'notajaxcall'));
        } else {
            if ($leafletSubspecialy = SiteSubspecialtyAnaestheticAgentDefault::model()->findByPk($itemId)) {
                $leafletSubspecialy->delete();
                echo 'success';
            } else {
                $this->render('errorpage', array('errormessage' => 'recordmissing'));
            }
        }
    }