public function getSnippetsByLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        //Ensure logged in
        if(!Permission::check('CODE_BANK_ACCESS')) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.PERMISSION_DENINED', '_Permission Denied');
            
            return $response;
        }
        
        
        $lang=SnippetLanguage::get()->byID(intval($data->id));
        if(!empty($lang) && $lang!==false && $lang->ID!=0 && $lang->Snippets()->Count()>0) {
            $snippets=$this->arrayUnmap($lang->Snippets()->filter('FolderID', 0)->map('ID', 'Title')->toArray());
            $response['data'][]=array(
                                    'id'=>$lang->ID,
                                    'language'=>$lang->Name,
                                    'folders'=>$this->mapFolders($lang->Folders()),
                                    'snippets'=>$snippets
                                );
        }
        
        
        return $response;
    }
public function getSnippetsByLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        //Ensure logged in
        if(!Permission::check('CODE_BANK_ACCESS')) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.PERMISSION_DENINED', '_Permission Denied');
            
            return $response;
        }
        
        
        $lang=SnippetLanguage::get()->byID(intval($data->id));
        if(!empty($lang) && $lang!==false && $lang->ID!=0 && $lang->Snippets()->Count()>0) {
            $snippets=$this->arrayUnmap($lang->Snippets()->filter('FolderID', 0)->map('ID', 'Title')->toArray());
            $response['data'][]=array(
                                    'id'=>$lang->ID,
                                    'language'=>$lang->Name,
                                    'folders'=>$this->mapFolders($lang->Folders()),
                                    'snippets'=>$snippets
                                );
        }
        
        
        return $response;
    }
public function getSnippetsByLanguage ( $ data ) { $ response = CodeBank_ClientAPI :: responseBase ( ) ; //Ensure logged in if ( ! Permission :: check ( 'CODE_BANK_ACCESS' ) ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.PERMISSION_DENINED' , '_Permission Denied' ) ; return $ response ; } $ lang = SnippetLanguage :: get ( ) -> byID ( intval ( $ data -> id ) ) ; if ( ! empty ( $ lang ) && $ lang !== false && $ lang -> ID != 0 && $ lang -> Snippets ( ) -> Count ( ) > 0 ) { $ snippets = $ this -> arrayUnmap ( $ lang -> Snippets ( ) -> filter ( 'FolderID' , 0 ) -> map ( 'ID' , 'Title' ) -> toArray ( ) ) ; $ response [ 'data' ] [ ] = array ( 'id' => $ lang -> ID , 'language' => $ lang -> Name , 'folders' => $ this -> mapFolders ( $ lang -> Folders ( ) ) , 'snippets' => $ snippets ) ; } return $ response ; }
Gets a list of snippets that are in the selected index in an array of languages
@param {stdClass} $data Data passed from ActionScript
@return {array} Standard response base
Gets a list of snippets that are in the selected index in an array of languages