public function deleteLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            $lang=SnippetLanguage::get()->byID(intval($data->id));
            if(!empty($lang) && $lang!==false && $lang->ID!=0) {
                if($lang->canDelete()==false) {
                    $response['status']='EROR';
                    $response['message']=_t('CodeBankAPI.LANGUAGE_DELETE_ERROR', '_Language cannot be deleted, it is either not a user language or has snippets attached to it');
                    
                    return $response;
                }
            }else {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_NOT_FOUND', '_Language not found');
                
                return $response;
            }
            
            
            $lang->delete();
            
            
            $response['status']='HELO';
            $response['message']="Language deleted successfully";
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
public function deleteLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            $lang=SnippetLanguage::get()->byID(intval($data->id));
            if(!empty($lang) && $lang!==false && $lang->ID!=0) {
                if($lang->canDelete()==false) {
                    $response['status']='EROR';
                    $response['message']=_t('CodeBankAPI.LANGUAGE_DELETE_ERROR', '_Language cannot be deleted, it is either not a user language or has snippets attached to it');
                    
                    return $response;
                }
            }else {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_NOT_FOUND', '_Language not found');
                
                return $response;
            }
            
            
            $lang->delete();
            
            
            $response['status']='HELO';
            $response['message']="Language deleted successfully";
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
public function deleteLanguage ( $ data ) { $ response = CodeBank_ClientAPI :: responseBase ( ) ; try { $ lang = SnippetLanguage :: get ( ) -> byID ( intval ( $ data -> id ) ) ; if ( ! empty ( $ lang ) && $ lang !== false && $ lang -> ID != 0 ) { if ( $ lang -> canDelete ( ) == false ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.LANGUAGE_DELETE_ERROR' , '_Language cannot be deleted, it is either not a user language or has snippets attached to it' ) ; return $ response ; } } else { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.LANGUAGE_NOT_FOUND' , '_Language not found' ) ; return $ response ; } $ lang -> delete ( ) ; $ response [ 'status' ] = 'HELO' ; $ response [ 'message' ] = "Language deleted successfully" ; } catch ( Exception $ e ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.SERVER_ERROR' , '_Server error has occured, please try again later' ) ; } return $ response ; }
Deletes a language from the database
@param {stdClass} $data Data passed from ActionScript
@return {array} Returns a standard response array
Deletes a language from the database