public function export_to_client() {
        if(!Permission::check('CODE_BANK_ACCESS')) {
            return Security::permissionFailure($this);
        }
        
        
        //Bump up time limit we may need it
        set_time_limit(480);
        
        
        //Dump Data
        $languages=$this->queryToArray(DB::query('SELECT "ID", "Name", "FileExtension", "HighlightCode", "UserLanguage" FROM "SnippetLanguage"'));
        $snippets=$this->queryToArray(DB::query('SELECT "ID", "Title", "Description", "Tags", "LanguageID", "PackageID", "FolderID" FROM "Snippet"'));
        $versions=$this->queryToArray(DB::query('SELECT "ID", "Created", "Text", "ParentID" FROM "SnippetVersion"'));
        $packages=$this->queryToArray(DB::query('SELECT "ID", "Title" FROM "SnippetPackage"'));
        $folders=$this->queryToArray(DB::query('SELECT "ID", "Name", "ParentID", "LanguageID" FROM "SnippetFolder"'));
        
        
        //Build final response array
        $response=array(
                        'format'=>'ToClient',
                        'data'=>array(
                                    'languages'=>$languages,
                                    'snippets'=>$snippets,
                                    'versions'=>$versions,
                                    'packages'=>$packages,
                                    'folders'=>$folders
                                )
                    );
        
        
        //Send File
        SS_HTTPRequest::send_file(json_encode($response), date('Y-m-d_hi').'.cbexport', 'application/json')->output();
        
        
        //Save session and exit
        Session::save();
        exit;
    }
public function export_to_client() {
        if(!Permission::check('CODE_BANK_ACCESS')) {
            return Security::permissionFailure($this);
        }
        
        
        //Bump up time limit we may need it
        set_time_limit(480);
        
        
        //Dump Data
        $languages=$this->queryToArray(DB::query('SELECT "ID", "Name", "FileExtension", "HighlightCode", "UserLanguage" FROM "SnippetLanguage"'));
        $snippets=$this->queryToArray(DB::query('SELECT "ID", "Title", "Description", "Tags", "LanguageID", "PackageID", "FolderID" FROM "Snippet"'));
        $versions=$this->queryToArray(DB::query('SELECT "ID", "Created", "Text", "ParentID" FROM "SnippetVersion"'));
        $packages=$this->queryToArray(DB::query('SELECT "ID", "Title" FROM "SnippetPackage"'));
        $folders=$this->queryToArray(DB::query('SELECT "ID", "Name", "ParentID", "LanguageID" FROM "SnippetFolder"'));
        
        
        //Build final response array
        $response=array(
                        'format'=>'ToClient',
                        'data'=>array(
                                    'languages'=>$languages,
                                    'snippets'=>$snippets,
                                    'versions'=>$versions,
                                    'packages'=>$packages,
                                    'folders'=>$folders
                                )
                    );
        
        
        //Send File
        SS_HTTPRequest::send_file(json_encode($response), date('Y-m-d_hi').'.cbexport', 'application/json')->output();
        
        
        //Save session and exit
        Session::save();
        exit;
    }
public function export_to_client ( ) { if ( ! Permission :: check ( 'CODE_BANK_ACCESS' ) ) { return Security :: permissionFailure ( $ this ) ; } //Bump up time limit we may need it set_time_limit ( 480 ) ; //Dump Data $ languages = $ this -> queryToArray ( DB :: query ( 'SELECT "ID", "Name", "FileExtension", "HighlightCode", "UserLanguage" FROM "SnippetLanguage"' ) ) ; $ snippets = $ this -> queryToArray ( DB :: query ( 'SELECT "ID", "Title", "Description", "Tags", "LanguageID", "PackageID", "FolderID" FROM "Snippet"' ) ) ; $ versions = $ this -> queryToArray ( DB :: query ( 'SELECT "ID", "Created", "Text", "ParentID" FROM "SnippetVersion"' ) ) ; $ packages = $ this -> queryToArray ( DB :: query ( 'SELECT "ID", "Title" FROM "SnippetPackage"' ) ) ; $ folders = $ this -> queryToArray ( DB :: query ( 'SELECT "ID", "Name", "ParentID", "LanguageID" FROM "SnippetFolder"' ) ) ; //Build final response array $ response = array ( 'format' => 'ToClient' , 'data' => array ( 'languages' => $ languages , 'snippets' => $ snippets , 'versions' => $ versions , 'packages' => $ packages , 'folders' => $ folders ) ) ; //Send File SS_HTTPRequest :: send_file ( json_encode ( $ response ) , date ( 'Y-m-d_hi' ) . '.cbexport' , 'application/json' ) -> output ( ) ; //Save session and exit Session :: save ( ) ; exit ; }
Builds a json export file for importing on the client
Builds a json export file for importing on the client