Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4419 | Rev 6749 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4419 Rev 5837
Línea 10... Línea 10...
10
use Laminas\Db\Adapter\AdapterInterface;
10
use Laminas\Db\Adapter\AdapterInterface;
11
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
11
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
12
use Laminas\Mvc\Controller\AbstractActionController;
12
use Laminas\Mvc\Controller\AbstractActionController;
13
use Laminas\Log\LoggerInterface;
13
use Laminas\Log\LoggerInterface;
14
use Laminas\View\Model\JsonModel;
14
use Laminas\View\Model\JsonModel;
-
 
15
use LeadersLinked\Library\Zoom;
Línea 15... Línea 16...
15
 
16
 
16
class ZoomController extends AbstractActionController
17
class ZoomController extends AbstractActionController
17
{
18
{
18
    /**
19
    /**
Línea 59... Línea 60...
59
    }
60
    }
Línea 60... Línea 61...
60
    
61
    
61
 
62
 
-
 
63
    public function indexAction()
Línea 62... Línea 64...
62
    public function indexAction()
64
    {
63
    {
65
 
64
        
66
        
65
        $data = [
67
        $data = [
Línea -... Línea 68...
-
 
68
            'success' => false,
66
            'success' => false,
69
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
67
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
70
        ];
Línea 68... Línea 71...
68
        ];
71
        
69
        
72
 
Línea 180... Línea 183...
180
    
183
    
181
    public function listingAction()
184
    public function listingAction()
182
    {
185
    {
Línea 183... Línea 186...
183
        $request = $this->getRequest();
186
        $request = $this->getRequest();
184
        
-
 
185
        //if($request->isGet()) {
-
 
186
            
-
 
187
            $next_page_token = $this->params()->fromRoute('next_page');
-
 
188
            
-
 
189
            
-
 
190
            $base_url = $this->config['leaderslinked.zoom.base_url'];
-
 
191
            $token = $this->getAccessToken();
-
 
192
            
-
 
193
            $client = new Client([
-
 
194
                
-
 
Línea 195... Línea -...
195
                'base_uri' => $base_url,
-
 
196
            ]);
-
 
197
            
-
 
198
            $request = [
-
 
199
                'headers' => [
-
 
200
                    'Authorization' => 'Bearer '. $token
-
 
201
                ],
-
 
202
                'type' => 'scheduled'
-
 
203
            ];
-
 
204
            
-
 
Línea -... Línea 187...
-
 
187
        
205
            if (!empty($next_page_token)) {
188
        if($request->isGet()) {
Línea 206... Línea -...
206
                $request['query'] = ['next_page_token' => $next_page_token];
-
 
207
            }
-
 
208
            
-
 
209
            $response = $client->request('GET', '/v2/users/me/meetings', $request);
-
 
Línea 210... Línea -...
210
            
-
 
Línea 211... Línea 189...
211
echo '<pre>';
189
            
212
print_r(json_decode($response->getBody()->getContents())); 
190
            
213
echo '</pre>';
-
 
214
exit;
-
 
215
 
-
 
216
            $data = json_decode($response->getBody());
-
 
217
            
-
 
Línea -... Línea 191...
-
 
191
            $zoom = new Zoom($this->adapter, $this->config, $this->cache);
218
            if ( !empty($data) ) {
192
            $response =  $zoom->getOAuthAccessToken();
219
                foreach ( $data->meetings as $d ) {
193
            
-
 
194
 
-
 
195
            
-
 
196
            if($response['success']) {
220
                    $topic = $d->topic;
197
                $next_page_token = $this->params()->fromRoute('next_page');
-
 
198
                
221
                    $join_url = $d->join_url;
199
                
Línea -... Línea 200...
-
 
200
                $access_token = $response['data'];
-
 
201
                $response = $zoom->getMeetings($access_token, $next_page_token) ; 
222
                    echo "<h3>Topic: $topic</h3>";
202
                return new JsonModel($response);
223
                    echo "Join URL: $join_url";
203
                
224
                }
204
                
225
                
205
            } else {
226
                if ( !empty($data->next_page_token) ) {
206
               return new JsonModel($response);
227
                    list_meetings($data->next_page_token);
207
            }
Línea 228... Línea 208...
228
                }
208
            
Línea 229... Línea 209...
229
            }
209
           
230
            
210
            
Línea 231... Línea 211...
231
           /* 
211
           
232
        } else {
212
        } else {
233
            $data = [
213
            $data = [
Línea 343... Línea 323...
343
        }
323
        }
Línea 344... Línea 324...
344
        
324
        
345
        return new JsonModel($data);*/
325
        return new JsonModel($data);*/
Línea 346... Línea -...
346
    }
-
 
347
    
-
 
348
    private function getAccessToken() {
-
 
349
        
-
 
350
        $api_key = $this->config['leaderslinked.zoom.api_key'];
-
 
Línea 351... Línea -...
351
        $api_secret   = $this->config['leaderslinked.zoom.api_secret'];
-
 
352
        
-
 
353
 
-
 
354
        $payload =[
-
 
355
            'iss'   => $api_key,
-
 
356
            'exp'   => time() + 3600,
-
 
Línea 357... Línea 326...
357
        ];
326
    }