BxDolTwigModule::_actionMarkFeatured PHP Method

_actionMarkFeatured() public method

public _actionMarkFeatured ( $iEntryId, $sMsgSuccessAdd, $sMsgSuccessRemove )
    function _actionMarkFeatured($iEntryId, $sMsgSuccessAdd, $sMsgSuccessRemove)
    {
        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->isAllowedMarkAsFeatured($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
            echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
            exit;
        }
        if ($this->_oDb->markAsFeatured($iEntryId)) {
            $this->isAllowedMarkAsFeatured($aDataEntry, true);
            // perform action
            $this->onEventMarkAsFeatured($iEntryId, $aDataEntry);
            $sRedirect = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
            $sJQueryJS = genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
            echo MsgBox($aDataEntry[$this->_oDb->_sFieldFeatured] ? $sMsgSuccessRemove : $sMsgSuccessAdd) . $sJQueryJS;
            exit;
        }
        echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
        exit;
    }

Usage Example

Ejemplo n.º 1
0
 function actionMarkFeatured($iEntryId)
 {
     parent::_actionMarkFeatured($iEntryId, _t('_bx_store_msg_added_to_featured'), _t('_bx_store_msg_removed_from_featured'));
 }
All Usage Examples Of BxDolTwigModule::_actionMarkFeatured