BxDolTwigModule::_actionDelete PHP Method

_actionDelete() public method

public _actionDelete ( $iEntryId, $sMsgSuccess )
    function _actionDelete($iEntryId, $sMsgSuccess)
    {
        header('Content-type:text/html;charset=utf-8');
        $iEntryId = (int) $iEntryId;
        if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin()))) {
            echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
            exit;
        }
        if (!$this->isAllowedDelete($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
            echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
            exit;
        }
        if ($this->_oDb->deleteEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin())) {
            $this->isAllowedDelete($aDataEntry, true);
            // perform action
            $this->onEventDeleted($iEntryId, $aDataEntry);
            $sRedirect = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/' . ($this->_iProfileId ? 'user/' . $this->_oDb->getProfileNickNameById($this->_iProfileId) : '');
            $sJQueryJS = genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
            echo MsgBox(_t($sMsgSuccess)) . $sJQueryJS;
            exit;
        }
        echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
        exit;
    }

Usage Example

Ejemplo n.º 1
0
 function actionDelete($iEntryId)
 {
     parent::_actionDelete($iEntryId, _t('_bx_store_msg_product_was_deleted'));
 }
All Usage Examples Of BxDolTwigModule::_actionDelete