BxDolTwigModule::actionActivate PHP Method

actionActivate() public method

public actionActivate ( $iEntryId )
    function actionActivate($iEntryId)
    {
        header('Content-type:text/html;charset=utf-8');
        $iEntryId = (int) $iEntryId;
        if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, 0, true))) {
            echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
            exit;
        }
        if (!$this->isAllowedActivate($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
            echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
            exit;
        }
        if ($this->_oDb->activateEntry($iEntryId)) {
            $this->isAllowedActivate($aDataEntry, true);
            $sRedirect = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
            echo MsgBox(_t('_Success')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
            exit;
        }
        echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
        exit;
    }