Jump to content

phils

Level 5*
  • Posts

    661
  • Joined

  • Last visited

  • Days Won

    2

Status Replies posted by phils

  1. Hello Phils

    I am trying to integrate evernote in one of my websites using PHP SDK.

    Initially my requirement was simple:

    My boss has a premium account and i created a developer token and manages to get notes for a particular search string. it works a treat.

    However, i now need to add more accounts, so i created the tokens and tried to access the same way, but it does not work.

    This time the accounts are not premium.

     

    My code here:

    require_once '../libs/evernote/src/autoload.php';
    require_once('../libs/mysql.class.php');
    require_once('../libs/debug.php');
    require_once('../libs/functions.php');
    
    session_start();
    
    $gMysql = new MySQL_Class(array("host"=>"localhost","user"=>"horscote","password"=>"feO@6i77","dbname"=>"horscote"));
    $gMysql->connect();
     
    $siren = $_POST['id'];
     
    //if logged user - saved as viewed
    $sqlViewed = 'SELECT evernoteSync FROM company WHERE SIREN='.$siren;
    $isSync = $gMysql->queryValue($sqlViewed);
    $gMysql->close();
    
    if($isSync==1)
    {
        $gMysql->connect();
        //get all admin evernotes
        $evernotes = $gMysql->queryList('SELECT * FROM evernote_users e inner join users u on u.id=e.userid WHERE evernote=1 ORDER BY e.ID');
    
        
        $maintable = '';
        foreach($evernotes as $evernote)
        {
            //var_dump($evernote);
            
            $token = $evernote['token'];
    
            $sandbox = false;
            $china   = false;
    
            $client = new \Evernote\Client($token, $sandbox, null, null, $china);
        
            $search = new \Evernote\Model\Search($siren);
        
            $notebook = new \Evernote\Model\Notebook();
        
            //$notebook->guid = $evernote['notebook_guid'];
    
            //$scope = \Evernote\Client::SEARCH_SCOPE_ALL;
    
            //$order = \Evernote\Client::SORT_ORDER_REVERSE | \Evernote\Client::SORT_ORDER_RECENTLY_CREATED;
    
            //var_dump($notebook);
            $maxResult = 5;
    
            $results = $client->findNotesWithSearch($search, $notebook, $scope, $order, $maxResult);
    
            //var_dump($results);
    
            $table = '<div class="panel-group" id="accordionEvernote" role="tablist" aria-multiselectable="true" style="margin-top:10px">';
            $i=0;
            foreach ($results as $result) {
                $noteGuid    = $result->guid;
                $note = $client->getNote($noteGuid);
    
                $in = '';
                if($i==0)
                {
                    $in = ' in';
                    $plusMinus = '<i class="more-less fa fa-chevron-right"></i>';
                }
                else
                {
                    $plusMinus = '<i class="more-less fa fa-chevron-right"></i>';
                }
            
                $advancedClient = new \Evernote\AdvancedClient($token, $sandbox);
                $noteStore = $advancedClient->getNoteStore();
                $userStore = $advancedClient->getUserStore();
                $userInfo = $userStore->getPublicUserInfo($evernote['username']);
     
                $completeNote = $noteStore->getNote($token,$noteGuid,TRUE,TRUE,TRUE,TRUE);
                $resources = $completeNote->resources;
                $sResources = '';
                foreach($resources as $res)
                {
                    $resource = $noteStore->getResource($token, $res->guid, true, true, true, true);        
                    $fileContent = $res->data->body;  
                    $fileType = $res->mime;  
                    $fileName = $res->attributes->filename;
                            
                    $resGuid = $res->guid; // example GUID
                    $resUrl = $userInfo->webApiUrlPrefix . 'res/' . $resGuid;
     
                    $attribute = $noteStore->getResourceAttributes($token, $res->guid);  
     
                    $fileName = $attribute->fileName;
                    $sResources .= '
                    <div class="col-xs-10 col-sm-4 col-md-2">
                  <div class="thumbnail" style="text-align:center">
                    <i class="fa fa-file-text" aria-hidden="true" style="font-size:40px;color:#F05F40"></i>
                      <div class="caption">
                        <a tatget="_blank" href="'.$resUrl.'" style="font-size:10px">'.$fileName.'</a>
                    </div>
                  </div>
                </div>';
                }
                    
                $tags = $noteStore->getNoteTagNames($token,$noteGuid);
    
                $created = date('d/m/Y',$completeNote->created/1000); 
                $updated = date('d/m/Y',$completeNote->updated/1000); 
    
                $hashTags = '';        
                foreach($tags as $tag)
                {
                    $hashTags .='<span class="label label-primary" style="margin-right:5px"> <i class="fa fa-tag" aria-hidden="true"></i> '.$tag.'</span>';
                }
    
                $table .='<div class="panel panel-default">
                    <div class="panel-heading" role="tab" id="heading'.$note->guid.'">
                        <h4 class="panel-title" style="font-size:12px">
                            <a role="button" data-toggle="collapse" data-parent="#accordionEvernote" href="#collapse'.$note->guid.'" aria-expanded="true" aria-controls="collapse'.$note->guid.'">
                            
                                '.$plusMinus.'
                                '.$note->title.' - Crée le '.$created.' par '.$evernote['firstName'].' - Modifié le '.$updated.'</i>
                            </a>
                        </h4>
                    </div>
                    <div id="collapse'.$note->guid.'" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading'.$note->guid.'">
                        <div class="panel-body">
                              <div id="ntD'.$note->guid.'">  
                              <div style="margin-bottom:10px">'.$hashTags.'</div>
                              <div style="margin-bottom:10px" id="resources" class="row">'.$sResources.'</div>
                              '.$note->content.'
                              </div>
                        </div>
                    </div>
                </div>';
            
                
                $i++;
            }
            $maintable .=$table;
        }
    
        $gMysql->close();
    
        if(isset($noteGuid) && !empty($noteGuid))
        {
            
            echo '<div style="text-align:justify">'.$maintable.'</div>';
        }
        else
        {
            $table = 'Aucune note trouvée pour cette société.';
            echo $table;
        
        }
    }
    else
    {
        $table = '<div style="text-align:center"><button class="btn btn-success btn-lg" onclick="sync('.$siren.')"> Syncroniser</button></div>';
        echo $table;
    }

     

     

    Thanks

     

    1. phils

      phils

      Hi Kesaven,

      I"m afraid I'm not familiar with PHP so will be difficult to help.  Try contacting @Laurent Sarrazin - he's the Evernote PHP guru.

  2. iluc

    iluc    phils

    Hi @phils

    I have not been able to compile simple examples in the Excel on using the Evernote Cloud SDK within a VBA application. Msgbox with error "object library feature not supported".

        Dim myNotebooks As ENCollection
        Set myNotebooks = EvernoteSession.sharedSession.ListNotebooksForCOM() <<<=== This line.

    I've used Excel 2007 with VBA 6.3 on Windows 8.1 64 bits. Please, help me.

     

    Thank you.

    Luciano

    @iluc

    1. phils

      phils

      That error is indicative of some issue relating to your References, I think.  Under Tools > References, make sure you have "Evernote Cloud SDK for Windows" checked.  If that's not the issue, it may be related to "OLE Automation"; for example here's a discussion about that.

    2. (See 1 other reply to this status update)

  3. Hi Phil.  Newbie here. Just discovered how amazing Scannable is for receipt image capture into Evernote. Now I need to get the receipt information into Excel for my bookkeeping. Saw a post from you on another thread about a pending Excel export feature. Manual cut and paste from into Excel is tedious and I have to devise a brilliant, consistent naming system for each file upfront. ReceiptMate's 'we do it all' approach seems to be more than I need? Suggestions on where to look, or how to proceed?

    1. phils

      phils

      Hi Robbie,

      It wasn't so much an Excel export feature as a provision without the Evernote Windows SDK to allow developer code to talk ot Evernote inside of Excel VBA.  Unfortunately I never got a chance to finish that work.

    2. (See 2 other replies to this status update)

  4. Hi Phil,

    Let's say I'm using the app I'm developing (let's call it RocketApp), which is an app that does stuff with Evernote notes. My app runs only on the iPad for now.  It's expensive for me to pay developers to recreate all of Evernote's search features, and I'd rather use EVernote to find specific notes anyway.

    I'm wondering...would it be possible to have the folllowing happen when the user taps the search field:

    1. The user's iPad automatically goes into multitasking with Evernote as the secondary app on the right hand side of the screen.  
    2. The user uses Evernote to find one or multiple notes.
    3. When he taps on the primary app to return to RocketApp, Evernote passes either the multiple or single GUID it has from it's last search over to RocketApp
    4. RocketApp populates its screen with those GUIDs

    I'm not technical in the least, but I'm trying to find out if this would work.  IMG_2799.thumb.jpg.d3bcfdc907b8ed1f6fca3

    1. phils

      phils

      I'm not an iOS expert but to my knowledge, it's not possible to communicate between the primary and secondary apps like you're wanting.

      (FYI I'm traveling internationally for the next few weeks - in Pottsylvania of course - so may be online only sporadically.)

       

    2. (See 2 other replies to this status update)

×
×
  • Create New...